Part Number Hot Search : 
AZV321 2SC49 ASM3106C 15000 NVD4804N AZV321 D15SB60 567M0
Product Description
Full Text Search
 

To Download M30302M4-XXXFP Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  description 1 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r description the m16c/30 group of single-chip microcomputers are built using the high-performance silicon gate cmos process using a m16c/60 series cpu core and are packaged in a 100-pin plastic molded qfp. these single-chip microcomputers operate using sophisticated instructions featuring a high level of instruction efficiency. with 1m bytes of address space, they are capable of executing instructions at high speed. they also feature a built-in multiplier and dmac, making them ideal for controlling office, communications, indus- trial equipment, and other high-speed processing applications. the m16c/30 group includes a wide range of products with different internal memory sizes and various package types. features ? memory capacity .................................. rom (see figure 1.1.4. rom expansion) ram 2k to 3k bytes ? shortest instruction execution time ...... 62.5ns (f(x in )=16mh z , v cc =5v) 100ns (f(x in )=10mh z , v cc =3v, with software one-wait) ? supply voltage ..................................... 4.2v to 5.5v (f(x in )=16mh z , without software wait) 2.7v to 5.5v (f(x in )=10mh z with software one-wait) ? low power consumption ...................... 25.5mw ( f(x in )=10mh z , with software one-wait, v cc = 3v) ? interrupts .............................................. 16 internal and 5 external interrupt sources, 4 software interrupt sources; 7 levels (including key input interrupt) ? multifunction 16-bit timer ...................... 3 output timers + 2 input timers ? serial i/o .............................................. 3 channels (3 for uart or clock synchronous) ? dmac .................................................. 1 channels (trigger: 14 sources) ? a-d converter ....................................... 10 bits x 8 channels (expandable up to 10 channels) ? watchdog timer .................................... 1 line ? programmable i/o port ........................ 87 lines ? input port .............................................. _______ 1 line (p8 5 shared with nmi pin) ? memory expansion .............................. available (to a maximum of 1m bytes) ? chip select output ................................ 4 lines ? clock generating circuit ....................... 2 built-in clock generation circuits (built-in feedback resistor, and external ceramic or quartz oscillator) applications audio, cameras, office equipment, communications equipment, portable equipment ------table of contents------ timer ............................................................. 75 serial i/o ....................................................... 93 a-d converter ............................................. 130 programmable i/o ports ............................. 136 electrical characteristics ............................. 146 central processing unit (cpu) ..................... 11 reset ............................................................. 14 processor mode ............................................ 21 clock generating circuit ............................... 34 protection ...................................................... 43 interrupt ......................................................... 44 watchdog timer ............................................ 64 dmac ........................................................... 66 rev.1.0
description 2 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r 1 2 3 4 5 6 7 8 9 101112131415161718192021222324252627282930 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 1 00 p0 0 /d 0 p0 1 /d 1 p0 2 /d 2 p0 3 /d 3 p0 4 /d 4 p0 5 /d 5 p0 6 /d 6 p0 7 /d 7 p1 0 /d 8 p1 1 /d 9 p1 2 /d 10 p1 3 /d 11 p1 4 /d 12 v ref av ss v cc x in x out v ss reset cnvss p8 7 /x cin p8 6 /x cout byte p2 0 /a 0 (/d 0 /-) p2 1 /a 1 (/d 1 /d 0 ) p2 2 /a 2 (/d 2 /d 1 ) p2 3 /a 3 (/d 3 /d 2 ) p2 4 /a 4 (/d 4 /d 3 ) p2 5 /a 5 (/d 5 /d 4 ) p2 6 /a 6 (/d 6 /d 5 ) p2 7 /a 7 (/d 7 /d 6 ) p3 0 /a 8 (/-/d 7 ) p3 1 /a 9 p3 2 /a 10 p3 3 /a 11 p3 4 /a 12 p3 5 /a 13 p3 6 /a 14 p3 7 /a 15 p4 0 /a 16 p4 1 /a 17 p4 2 /a 18 p4 3 /a 19 p7 4 /ta2 out p7 6 p5 6 /ale p7 7 p5 5 /hold p5 4 /hlda p5 3 /bclk p5 2 /rd vcc vss p5 7 /rdy/clk out p4 5 /cs1 p4 6 /cs2 p4 7 /cs3 avcc p6 3 /t x d 0 p6 5 /clk 1 p6 6 /rxd 1 p6 7 /t x d 1 p6 1 /clk 0 p6 2 /rxd 0 p10 0 /an 0 p10 1 /an 1 p10 2 /an 2 p10 3 /an 3 p9 3 p9 4 p9 5 /anex0 p9 6 /anex1 p9 1 /tb1 in p9 2 /tb2 in p8 0 p6 0 /cts 0 /rts 0 p6 4 /cts 1 /rts 1 /clks 1 p7 2 /clk 2 /ta1 out p8 2 /int 0 p7 1 /rxd 2 /scl/ta0 in (note) p8 3 /int 1 p8 5 /nmi p9 7 /ad trg p4 4 /cs0 p5 0 /wrl/wr p5 1 /wrh/bhe p9 0 p7 0 /t x d 2 /sda/ta0 out (note) p8 4 /int 2 p8 1 p7 5 /ta2 in p1 5 /d 13 p1 6 /d 14 p1 7 /d 15 p10 7 /an 7 /ki 3 p10 6 /an 6 /ki 2 p10 5 /an 5 /ki 1 p10 4 /an 4/ ki 0 p7 3 /cts 2 /rts 2 /ta1 in note: p7 0 and p7 1 are n channel open-drain output pin. pin configuration figures 1.1.1 and 1.1.2 show the pin configurations (top view). pin configuration (top view) package: 100p6s-a figure 1.1.1. pin configuration (top view) m16c/30 group
description 3 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r 1 2 3 4 5 6 7 8 9 1011121314151617181920 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 1 00 p0 0 /d 0 p0 1 /d 1 p0 2 /d 2 p0 3 /d 3 p0 4 /d 4 p0 5 /d 5 p0 6 /d 6 p0 7 /d 7 p1 0 /d 8 p1 1 /d 9 p1 2 /d 10 p1 3 /d 11 p1 4 /d 12 v ref av ss v cc x in x out v ss cnvss p8 7 /x cin p8 6 /x cout byte p2 0 /a 0 (/d 0 /-) p2 1 /a 1 (/d 1 /d 0 ) p2 2 /a 2 (/d 2 /d 1 ) p2 3 /a 3 (/d 3 /d 2 ) p2 4 /a 4 (/d 4 /d 3 ) p2 5 /a 5 (/d 5 /d 4 ) p2 6 /a 6 (/d 6 /d 5 ) p2 7 /a 7 (/d 7 /d 6 ) p3 0 /a 8 (/-/d 7 ) p3 1 /a 9 p3 2 /a 10 p3 3 /a 11 p3 4 /a 12 p3 5 /a 13 p3 6 /a 14 p3 7 /a 15 p4 0 /a 16 p4 1 /a 17 p4 2 /a 18 p4 3 /a 19 p7 4 /ta2 out p7 6 p5 6 /ale p7 7 p5 5 /hold p5 4 /hlda p5 3 /bclk p5 2 /rd vcc vss p5 7 /rdy/clk out p4 5 /cs1 p4 6 /cs2 p4 7 /cs3 avcc p6 3 /t x d 0 p6 5 /clk 1 p6 6 /rxd 1 p6 7 /t x d 1 p6 1 /clk 0 p6 2 /rxd 0 p10 0 /an 0 p10 1 /an 1 p10 2 /an 2 p10 3 /an 3 p9 3 p9 4 p9 5 /anex0 p9 6 /anex1 p9 1 /tb1 in p9 2 /tb2 in p8 1 p8 0 p6 0 /cts 0 /rts 0 p6 4 /cts 1 /rts 1 /clks 1 p9 7 /ad trg p4 4 /cs0 p5 0 /wrl/wr p5 1 /wrh/bhe p9 0 p7 2 /clk 2 /ta1 out p7 1 /rxd 2 /scl/ta0 in (note) p7 0 /t x d 2 /sda/ta0 out (note) p7 5 /ta2 in p1 5 /d 13 p1 6 /d 14 p1 7 /d 15 p10 7 /an 7 /ki 3 p10 6 /an 6 /ki 2 p10 5 /an 5 /ki 1 p10 4 /an 4/ ki 0 note: p7 0 and p7 1 are n channel open-drain output pin. p8 2 /int 0 p8 3 /int 1 p8 5 /nmi p8 4 /int 2 p7 3 /cts 2 /rts 2 /ta1 in reset figure 1.1.2. pin configuration (top view) package: 100p6q-a pin configuration (top view) m16c/30 group
description 4 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r block diagram figure 1.1.3 is a block diagram of the m16c/30 group. aaaa aaaa timer timer ta0 (16 bits) timer ta1 (16 bits) timer ta2 (16 bits) timer tb1 (16 bits) timer tb2 (16 bits) internal peripheral functions watchdog timer (15 bits) dmac (1 channel) a-d converter (10 bits x 8 channels expandable up to 10 channels) uart/clock synchronous si/o (8 bits x 3 channels) system clock generator x in -x out x cin -x cout m16c/60 series16-bit cpu core i/o ports port p0 8 port p1 8 port p2 8 port p3 8 port p4 8 port p5 8 port p6 8 8 r0l r0h r1h r1l r2 r3 a0 a1 fb r0l r0h r1h r1l r2 r3 a0 a1 fb registers isp usp stack pointer multiplier 7 8 8 port p10 port p9 port p8 port p7 aaaaaa a aaaa a a aaaa a a aaaa a aaaaaa memory port p8 5 rom (note 1) ram (note 2) note 1: rom size depends on mcu type. note 2: ram size depends on mcu type. sb flg pc program counter vector table intb flag register figure 1.1.3. block diagram of m16c/30 group
description 5 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r item performance number of basic instructions 91 instructions shortest instruction execution time 62.5ns(f(x in )=16mh z , v cc =5v ) 100ns (f(x in )=10mh z , v cc =3v, with software one-wait) memory rom (see the figure 1.1.4. rom expansion) capacity ram 2k to 3k bytes i/o port p0 to p10 (except p8 5 ) 8 bits x 10, 7 bits x 1 input port p8 5 1 bit x 1 multifunction ta0, ta1, ta2 16 bits x 3 timer tb1, tb2 16 bits x 2 serial i/o uart0, uart1, uart2 (uart or clock synchronous) x 3 a-d converter 10 bits x (8+2) channels dmac 1 channels (trigger: 14 sources) watchdog timer 15 bits x 1 (with prescaler) interrupt 16 internal and 5 external sources, 4 software sources, 7 levels clock generating circuit 2 built-in clock generation circuits (built-in feedback resistor, and external ceramic or quartz oscillator) supply voltage 4.2v to 5.5v (f(x in )=16mh z , without software wait) 2.7v to 5.5v (f(x in )=10mh z with software one-wait) power consumption 25.5mw (f(x in ) = 10mh z , v cc =3v with software one-wait) i/o i/o withstand voltage 5v characteristics output current 5ma memory expansion available (to a maximum of 1m bytes) device configuration cmos high performance silicon gate package 100-pin plastic mold qfp table 1.1.1. performance outline of m16c/30 group performance outline table 1.1.1 is a performance outline of m16c/30 group.
description 6 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r mitsubishi plans to release the following products in the m16c/30 group: (1) support for mask rom version (2) rom capacity (3) package 100p6s-a : plastic molded qfp 100p6q-a : plastic molded qfp the m16c/30 group products currently supported are listed in table 1.1.2. table 1.1.2. m16c/30 group rom size (byte) 128k 96k 64k 32k m30302m8-xxxfp/gp m30302ma-xxxfp/gp m30302mc-xxxfp/gp mask rom version M30302M4-XXXFP/gp ram capacity rom capacity package type remarks type no. june, 2002 M30302M4-XXXFP 2k byte 100p6s-a m30302m4-xxxgp 100p6q-a m30302m8-xxxfp 64k byte 100p6s-a mask rom version m30302m8-xxxgp 100p6q-a 3k byte 100p6s-a 100p6q-a 100p6s-a 128k byte 100p6q-a 32k byte m30302ma-xxxfp m30302ma-xxxgp m30302mc-xxxfp m30302mc-xxxgp 96k byte ** ** ** ** ** ** * * **: under development * : new product figure 1.1.4. rom expansion
description 7 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r package type: fp : package 100p6s-a gp : 100p6q-a rom no. rom capacity: 4 : 32k bytes 8 : 64k bytes a : 96k bytes c : 128k bytes memory type: m : mask rom version type no. m 3 0 3 0 2 m 8 C x x x g p m16c/30 group m16c family shows ram capacity, pin count, etc (the value itself has no specific meaning) figure 1.1.5. type no., memory size, and package
pin description 8 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r v cc , v ss cnv ss x in x out byte av cc av ss v ref p0 0 to p0 7 d 0 to d 7 p1 0 to p1 7 d 8 to d 15 p2 0 to p2 7 a 0 to a 7 a 0 /d 0 to a 7 /d 7 a 0 a 1 /d 0 to a 7 /d 6 p3 0 to p3 7 a 8 to a 15 a 8 /d 7 , a 9 to a 15 p4 0 to p4 7 signal name power supply input cnv ss reset input clock input clock output external data bus width select input analog power supply input reference voltage input i/o port p0 i/o port p1 i/o port p2 i/o port p3 i/o port p4 supply 2.7v to 5.5 v to the v cc pin. supply 0 v to the v ss pin. function this pin switches between processor modes. connect this pin to the v ss pin when after a reset you want to start operation in single-chip mode (memory expansion mode) or the v cc pin when starting operation in microprocessor mode. a l on this input resets the microcomputer. these pins are provided for the main clock generating circuit.connect a ceramic resonator or crystal between the x in and the x out pins. to use an externally derived clock, input it to the x in pin and leave the x out pin open. this pin selects the width of an external data bus. a 16-bit width is selected when this input is l; an 8-bit width is selected when this input is h. this input must be fixed to either h or l. connect this pin to the v ss pin when not using external data bus. this pin is a power supply input for the a-d converter. connect this pin to v cc . this pin is a power supply input for the a-d converter. connect this pin to v ss . this pin is a reference voltage input for the a-d converter. this is an 8-bit cmos i/o port. it has an input/output port direction register that allows the user to set each pin for input or output individually. when used for input in single-chip mode, the port can be set to have or not have a pull-up resistor in units of four bits by software. in memory expansion and microprocessor modes, selection of the internal pull-resistor is not available. when set as a separate bus, these pins input and output data (d 0 Cd 7 ). this is an 8-bit i/o port equivalent to p0. when set as a separate bus, these pins input and output data (d 8 Cd 15 ). this is an 8-bit i/o port equivalent to p0. these pins output 8 low-order address bits (a 0 Ca 7 ). if the external bus is set as an 8-bit wide multiplexed bus, these pins input and output data (d 0 Cd 7 ) and output 8 low-order address bits (a 0 Ca 7 ) separated in time by multiplexing. if the external bus is set as a 16-bit wide multiplexed bus, these pins input and output data (d 0 Cd 6 ) and output address (a 1 Ca 7 ) separated in time by multiplexing. they also output address (a 0 ). this is an 8-bit i/o port equivalent to p0. these pins output 8 middle-order address bits (a 8 Ca 15 ). if the external bus is set as a 16-bit wide multiplexed bus, these pins input and output data (d 7 ) and output address (a 8 ) separated in time by multiplexing. they also output address (a 9 Ca 15 ). this is an 8-bit i/o port equivalent to p0. pin name input input input output input input input/output input/output input/output input/output i/o type analog power supply input input/output output input/output output input/output input/output output input/output output input/output output output a 16 to a 19 , cs 0 to cs 3 these pins output a 16 Ca 19 and cs 0 Ccs 3 signals. a 16 Ca 19 are 4 high- order address bits. cs 0 Ccs 3 are chip select signals used to specify an access space. reset pin description
pin description 9 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r pin description signal name function pin name i/o type i/o port p5 input/output input/output input/output input/output input/output input/output input input/output input/output i/o port p6 i/o port p7 i/o port p8 i/o port p8 5 i/o port p9 i/o port p10 p5 0 to p5 7 p6 0 to p6 7 p7 0 to p7 7 p8 0 to p8 4 , p8 6 , p8 7 , p8 5 p9 0 to p9 7 p10 0 to p10 7 this is an 8-bit i/o port equivalent to p0. in single-chip mode, p5 7 in this port outputs a divide-by-8 or divide-by-32 clock of x in or a clock of the same frequency as x cin as selected by software. output output output output output input output input this is an 8-bit i/o port equivalent to p0. when used for input in single- chip, memory expansion, and microprocessor modes, the port can be set to have or not have a pull-up resistor in units of four bits by software. pins in this port also function as uart0 and uart1 i/o pins as selected by software. this is an 8-bit i/o port equivalent to p6 (p7 0 and p7 1 are n channel open-drain output). pins in this port also function as timer a0Ca2, or uart2 i/o pins as selected by software. this is an 8-bit i/o port equivalent to p6. pins in this port also function as, timer b1, b2 input pins, a-d converter extended input pins, or a-d trigger input pins as selected by software. this is an 8-bit i/o port equivalent to p6. pins in this port also function as a-d converter input pins as selected by software. furthermore, p10 4 Cp10 7 also function as input pins for the key input interrupt function. wrl / wr, wrh / bhe, rd, bclk, hlda, hold, ale, rdy output wrl, wrh (wr and bhe), rd, bclk, hlda, and ale signals. wrl and wrh, and bhe and wr can be switched using software control. wrl, wrh, and rd selected with a 16-bit external data bus, data is written to even addresses when the wrl signal is l and to the odd addresses when the wrh signal is l. data is read when rd is l. wr, bhe, and rd selected data is written when wr is l. data is read when rd is l. odd addresses are accessed when bhe is l. use this mode when using an 8-bit external data bus. while the input level at the hold pin is l, the microcomputer is placed in the hold state. while in the hold state, hlda outputs a l level. ale is used to latch the address. while the input level of the rdy pin is l, the microcomputer is in the ready state. p8 0 to p8 4 , p8 6 , and p8 7 are i/o ports with the same functions as p6. using software, they can be made to function as the i/o pins for the input pins for external interrupts. p8 6 and p8 7 can be set using software to function as the i/o pins for a sub clock generation circuit. in this case, connect a quartz oscillator between p8 6 (x cout pin) and p8 7 (x cin pin). p8 5 is an input-only port that also functions for nmi. the nmi interrupt is generated when the input at this pin changes from h to l. the nmi function cannot be cancelled using software. the pull-up cannot be set for this pin.
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r memory 10 operation of functional blocks the m16c/30 group accommodates certain units in a single chip. these units include rom and ram to store instructions and data and the central processing unit (cpu) to execute arithmetic/logic operations. also included are peripheral units such as timers, serial i/o, dmac, a-d converter, and i/o ports. the following explains each unit. memory figure 1.3.1 is a memory map of the m16c/30 group. the address space extends the 1m bytes from address 00000 16 to fffff 16 . from fffff 16 down is rom. for example, in the m30302mc-xxxgp, there is 128k bytes of internal rom from e0000 16 to fffff 16 . the vector table for fixed interrupts such as _______ the reset and nmi are mapped to fffdc 16 to fffff 16 . the starting address of the interrupt routine is stored here. the address of the vector table for timer interrupts, etc., can be set as desired using the internal register (intb). see the section on interrupts for details. from 00400 16 up is ram. for example, in the m30302mc-xxxgp, 3k bytes of internal ram is mapped to the space from 00400 16 to 00fff 16 . in addition to storing data, the ram also stores the stack used when calling subroutines and when interrupts are generated. the sfr area is mapped to 00000 16 to 003ff 16 . this area accommodates the control registers for periph- eral devices such as i/o ports, a-d converter, serial i/o, and timers, etc. figures 1.6.1 to 1.6.3 are location of peripheral unit control registers. any part of the sfr area that is not occupied is reserved and cannot be used for other purposes. the special page vector table is mapped to ffe00 16 to fffdb 16 . if the starting addresses of subroutines or the destination addresses of jumps are stored here, subroutine call instructions and jump instructions can be used as 2-byte instructions, reducing the number of program steps. in memory expansion mode and microprocessor mode, a part of the spaces are reserved and cannot be used. for example, in the m30302mc-xxxgp, the following spaces cannot be used. ? the space between 01800 16 and 03fff 16 (memory expansion and microprocessor modes) ? the space between d0000 16 and dffff 16 (memory expansion mode) figure 1.3.1. memory map 00000 16 yyyyy 16 fffff 16 00400 16 04000 16 xxxxx 16 d0000 16 aaaaaa a aaaa a a aaaa a aaaaaa external area internal rom area sfr area for details, see figures 1.6.1 to 1.6.3 internal ram area internal reserved area (note 1) internal reserved area (note 2) ffe00 16 fffdc 16 fffff 16 note 1: during memory expansion and microprocessor modes, can not be used. note 2: in memory expansion mode, can not be used. undefined instruction overflow brk instruction address match single step watchdog timer reset special page vector table dbc nmi address yyyyy 16 rom size 32k bytes e8000 16 f0000 16 e0000 16 96k bytes 64k bytes 128k bytes f8000 16 2k bytes 00bff 16 address xxxxx 16 ram size 3k bytes 00fff 16
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r cpu 11 central processing unit (cpu) the cpu has a total of 13 registers shown in figure 1.4.1. seven of these registers (r0, r1, r2, r3, a0, a1, and fb) come in two sets; therefore, these have two register banks. (1) data registers (r0, r1, r1h, r2, and r3) data registers (r0, r1, r2, and r3) are configured with 16 bits, and are used primarily for transfer and arithmetic/logic operations. register r0 can be used as separate 8-bit data registers, r0h and r0l. register r1 can be used as separate 8-bit data registers, r1h and r1l. in some instructions, registers r2 and r0, as well as r3 and r1 can use as 32-bit data registers (r2r0 or r3r1). (2) address registers (a0 and a1) address registers (a0 and a1) are configured with 16 bits, and have functions equivalent to those of data registers. these registers can also be used for address register indirect addressing and address register relative addressing. in some instructions, registers a1 and a0 can be combined for use as a 32-bit address register (a1a0). aaaaaaa aaaaaaa h l b15 b8 b7 b0 r0 (note) aaaaaaa h l b15 b8 b7 b0 r1 (note) r2 (note) aaaaaaa aaaaaaa b15 b0 r3 (note) aaaaaaa aaaaaaa b15 b0 a0 (note) aaaaaaa aaaaaaa b15 b0 a1 (note) aaaaaaa aaaaaaa b15 b0 fb (note) aaaaaaa b15 b0 data registers address registers frame base registers b15 b0 b15 b0 b15 b0 b15 b0 b0 b19 b0 b19 h l program counter interrupt table register user stack pointer interrupt stack pointer static base register flag register pc intb usp isp sb flg note: these re g isters consist of two re g ister banks. a a aa aa aa aa a a aaaaaaa aaaaaaa a a aa aa aa aa aa aa a a c d z s b o i u ipl figure 1.4.1. central processing unit register
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r cpu 12 (3) frame base register (fb) frame base register (fb) is configured with 16 bits, and is used for fb relative addressing. (4) program counter (pc) program counter (pc) is configured with 20 bits, indicating the address of an instruction to be executed. (5) interrupt table register (intb) interrupt table register (intb) is configured with 20 bits, indicating the start address of an interrupt vector table. (6) stack pointer (usp or isp) stack pointer comes in two types: user stack pointer (usp) and interrupt stack pointer (isp), each config- ured with 16 bits. your desired type of stack pointer (usp or isp) can be selected by a stack pointer select flag (u flag). this flag is located at the position of bit 7 in the flag register (flg). (7) static base register (sb) static base register (sb) is configured with 16 bits, and is used for sb relative addressing. (8) flag register (flg) flag register (flg) is configured with 11 bits, each bit is used as a flag. figure 1.4.2 shows the flag register (flg). the following explains the function of each flag: ?bit 0: carry flag (c flag) this flag retains a carry, borrow, or shift-out bit that has occurred in the arithmetic/logic unit. ?bit 1: debug flag (d flag) this flag enables a single-step interrupt. when this flag is 1, a single-step interrupt is generated after instruction execution. this flag is cleared to 0 when the interrupt is acknowledged. ?bit 2: zero flag (z flag) this flag is set to 1 when an arithmetic operation resulted in 0; otherwise, cleared to 0. ?bit 3: sign flag (s flag) this flag is set to 1 when an arithmetic operation resulted in a negative value; otherwise, cleared to 0 . ?bit 4: register bank select flag (b flag) this flag chooses a register bank. register bank 0 is selected when this flag is 0 ; register bank 1 is selected when this flag is 1. ?bit 5: overflow flag (o flag) this flag is set to 1 when an arithmetic operation resulted in overflow; otherwise, cleared to 0. ?bit 6: interrupt enable flag (i flag) this flag enables a maskable interrupt. an interrupt is disabled when this flag is 0, and is enabled when this flag is 1. this flag is cleared to 0 when the interrupt is acknowledged.
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r cpu 13 ?bit 7: stack pointer select flag (u flag) interrupt stack pointer (isp) is selected when this flag is 0 ; user stack pointer (usp) is selected when this flag is 1. this flag is cleared to 0 when a hardware interrupt is acknowledged or an int instruction of software interrupt nos. 0 to 31 is executed. ?bits 8 to 11: reserved area ?bits 12 to 14: processor interrupt priority level (ipl) processor interrupt priority level (ipl) is configured with three bits, for specification of up to eight processor interrupt priority levels from level 0 to level 7. if a requested interrupt has priority greater than the processor interrupt priority level (ipl), the interrupt is enabled. ?bit 15: reserved area the c, z, s, and o flags are changed when instructions are executed. see the software manual for details. figure 1.4.2. flag register (flg) carry flag debug flag zero flag sign flag register bank select flag overflow flag interrupt enable flag stack pointer select flag reserved area processor interrupt priority level reserved area flag register (flg) aa aa aa aa a a aa aa aaaaaaa aaaaaaa aa aa aa aa aa aa a a aa aa c d z s b o i u ipl b0 b15
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r reset 14 figure 1.5.2. reset sequence reset there are two kinds of resets; hardware and software. in both cases, operation is the same after the reset. (see software reset for details of software resets.) this section explains on hardware resets. when the supply voltage is in the range where operation is guaranteed, a reset is effected by holding the reset pin level l (0.2v cc max.) for at least 20 cycles. when the reset pin level is then returned to the h level while main clock is stable, the reset status is cancelled and program execution resumes from the address in the reset vector table. the ram is undefined at power on. the initial value must therefore be set. when a reset signal is applied while the cpu is writing a value to the ram, the value may be set as unknown due to the termination of the cpu access. figure 1.5.1 shows the example reset circuit. figure 1.5.2 shows the reset sequence. figure 1.5.1. example reset circuit bclk address address address microprocessor mode byte = h microprocessor mode byte = l content of reset vector single chip mode bclk 24cycles ffffc 16 ffffd 16 ffffe 16 content of reset vector ffffc 16 ffffe 16 content of reset vector ffffe 16 x in reset rd wr cs0 rd wr cs0 ffffc 16 more than 20 cycles are needed reset v cc 0.8v reset v cc 0v 0v 5v 5v 4.0v example when v cc = 5v . more than 20 cycles of x in are needed.
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r reset 15 ____________ table 1.5.1 shows the statuses of the other pins while the reset pin level is l. figures 1.5.3 and 1.5.4 show the internal status of the microcomputer immediately after the reset is cancelled. ____________ table 1.5.1. pin status when reset pin level is l status cnv ss = v cc cnv ss = v ss byte = v ss byte = v cc pin name p0 p1 p2, p3, p4 0 to p4 3 p4 4 p4 5 to p4 7 p5 0 p5 1 p5 2 p5 3 p5 4 p5 5 p5 6 p5 7 p6, p7, p8 0 to p8 4 , p8 6 , p8 7 , p9, p10 input port (floating) input port (floating) input port (floating) input port (floating) input port (floating) input port (floating) input port (floating) input port (floating) input port (floating) input port (floating) input port (floating) input port (floating) input port (floating) input port (floating) data input (floating) data input (floating) address output (undefined) bclk output ale output (l level is output) cs0 output (h level is output) wr output (h level is output) rd output (h level is output) rdy input (floating) input port (floating) bclk output bhe output (undefined) hlda output (the output value depends on the input to the hold pin) hold input (floating) data input (floating) address output (undefined) cs0 output (h level is output) input port (floating) (pull-up resistor is on) input port (floating) input port (floating) rdy input (floating) ale output (l level is output) hold input (floating) hlda output (the output value depends on the input to the hold pin) rd output (h level is output) bhe output (undefined) wr output (h level is output) input port (floating) (pull-up resistor is on)
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r reset 16 figure 1.5.3. device's internal status after a reset is cleared x : nothing is mapped to this bit ? : undefined the content of other registers are undefined when the microcomputer is reset. the initial values must therefore be set. the ram is undefined at power on. the initial values must therefore be set. when a reset signal is applied while the cpu is writing a value to the ram, the value may be set as unknown due to the termination of the cpu access. note 1: when the v cc level is applied to the cnv ss pin, it is 03 16 at a reset. note 2: 00 16 is read out when set bit 7 (sdds) of the uart2 special mode register ( address 0377 16 ) to 1. (1) (0004 16 ) processor mode register 0 (note 1) 00 16 (3) (0006 16 ) system clock control register 0 1 00 00 10 0 (4) (0007 16 ) system clock control register 1 0 00 10 00 0 (5) (0008 16 ) chip select control register 0 00 00 01 0 (6) (0009 16 ) address match interrupt enable register 0 0 (7) protect register (000a 16 ) 00 0 (0015 16 ) 00 16 (0016 16 ) 0 0 0 0 (11) (002c 16 ) dma0 control register 00000?00 (000f 16 ) watchdog timer control register 0 0? 0 ???? (8) (9) (0010 16 ) address match interrupt register 0 00 16 (0011 16 ) 00 16 (0012 16 ) 0 0 0 0 (0014 16 ) address match interrupt register 1 00 16 (10) (004a 16 ) bus collision detection interrupt control register 0 0 0 ? (12) (14) (004d 16 ) key input interrupt control register ? 0 0 0 (004b 16 ) dma0 interrupt control register ? 0 0 0 (13) (15) a-d conversion interrupt control register (004e 16 ) ? 0 0 0 (2) (0005 16 ) processor mode register 1 0 0 00 00 (16) uart2 transmit interrupt control register (004f 16 ) ? 0 0 0 (17) uart2 receive interrupt control register (0050 16 ) ? 0 0 0 (18) uart0 transmit interrupt control register (0051 16 ) ? 0 0 0 (19) uart0 receive interrupt control register (0052 16 ) ? 0 0 0 (20) uart1 transmit interrupt control register (0053 16 ) ? 0 0 0 (30) interrupt cause select register 00 16 (035f 16 ) (21) uart1 receive interrupt control register (0054 16 ) ? 0 0 0 (22) timer a0 interrupt control register (0055 16 ) ? 0 0 0 (23) timer a1 interrupt control register (0056 16 ) ? 0 0 0 (24) timer a2 interrupt control register (0057 16 ) ? 0 0 0 (25) timer b1 interrupt control register (005b 16 ) ? 0 0 0 (26) timer b2 interrupt control register (005c 16 ) ? 0 0 0 (27) int0 interrupt control register (005d 16 ) ? 000 00 (28) int1 interrupt control register (005e 16 ) ? 000 00 (29) int2 interrupt control register (005f 16 ) ? 000 00 (037d 16 ) uart2 transmit/receive control register 1 010 00000 (36) (0378 16 ) 00 16 uart2 transmit/receive mode register (34) (037c 16 ) uart2 transmit/receive control register 0 000 00001 (35) (33) uart2 special mode register (0377 16 ) 00 16 (32) uart2 special mode register 2 (0376 16 ) 00 16 (31) uart2 special mode register 3 (note 2) (0375 16 ) ? (0383 16 ) trigger select flag (40) 00 16 (0384 16 ) up-down flag (41) 00 16 (0382 16 ) one-shot start flag (39) 0 00 0 000 count start flag (0380 16 ) 00 16 (37) 0 (0381 16 ) clock prescaler reset flag (38)
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r reset 17 (0396 16 ) timer a0 mode register (42) 00 16 (0397 16 ) timer a1 mode register (43) 00 16 (0398 16 ) timer a2 mode register (44) 00 16 (039c 16 ) timer b1 mode register (45) 00? 0000 (039d 16 ) timer b2 mode register (46) 00? 0000 (03a0 16 ) uart0 transmit/receive mode register (47) 00 16 (03a4 16 ) uart0 transmit/receive control register 0 (48) 000 1000 0 (03a5 16 ) uart0 transmit/receive control register 1 (49) 000 0010 0 (03a8 16 ) uart1 transmit/receive mode register (50) 00 16 (03ac 16 ) uart1 transmit/receive control register 0 (51) 000 1000 0 (03ad 16 ) uart1 transmit/receive control register 1 (52) 000 0010 0 (03b0 16 ) uart transmit/receive control register 2 (53) 00 0000 0 x : nothing is mapped to this bit ? : undefined the content of other registers are undefined when the microcomputer is reset. the initial values must therefore be set. the ram is undefined at power on. the initial values must therefore be set. when a reset signal is applied while the cpu is writing a value to the ram, the value may be set as unknown due to the termination of the cpu access. note: when the v cc level is applied to the cnv ss pin, it is 02 16 at a reset. (03d7 16 ) a-d control register 1 00 16 (57) (03e2 16 ) port p0 direction register (58) 00 16 (03e3 16 ) port p1 direction register (59) 00 16 (03e6 16 ) port p2 direction register (60) 00 16 (03e7 16 ) port p3 direction register (61) 00 16 (56) (03d6 16 ) a-d control register 0 000 0??? 0 (03d4 16 ) a-d control register 2 (55) 0 0000 (54) (03b8 16 ) dma0 cause select register 00 16 (03ea 16 ) port p4 direction register (62) 00 16 (03eb 16 ) port p5 direction register (63) 00 16 (03ee 16 ) port p6 direction register (64) 00 16 (03ef 16 ) port p7 direction register (65) 00 16 (03f3 16 ) port p9 direction register (67) 00 16 (03f6 16 ) port p10 direction register (68) 00 16 (03fc 16 ) pull-up control register 0 (69) 00 16 (03fd 16 ) pull-up control register 1(note) (70) 00 16 (03f2 16 ) port p8 direction register (66) 00 0 0 000 address registers (a0/a1) (74) 0000 16 frame base register (fb) (75) 0000 16 interrupt table register (intb) (76) 00000 16 user stack pointer (usp) (77) 0000 16 interrupt stack pointer (isp) (78) 0000 16 (03fe 16 ) pull-up control register 2 00 16 (71) (73) data registers (r0/r1/r2/r3) 0000 16 port control register 00 16 (72) (03ff 16 ) static base register (sb) 0000 16 (79) flag register (flg) 0000 16 (80) ??? figure 1.5.4. device's internal status after a reset is cleared
sfr 18 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.6.1. location of peripheral unit control registers (1) 0000 16 0001 16 0002 16 0003 16 0004 16 0005 16 0006 16 0007 16 0008 16 0009 16 000a 16 000b 16 000c 16 000d 16 000e 16 000f 16 0010 16 0011 16 0012 16 0013 16 0014 16 0015 16 0016 16 0017 16 0018 16 0019 16 001a 16 001b 16 001c 16 001d 16 001e 16 001f 16 0020 16 0021 16 0022 16 0023 16 0024 16 0025 16 0026 16 0027 16 0028 16 0029 16 002a 16 002b 16 002c 16 002d 16 002e 16 002f 16 0030 16 0031 16 0032 16 0033 16 0034 16 0035 16 0036 16 0037 16 0038 16 0039 16 003a 16 003b 16 003c 16 003d 16 003e 16 003f 16 0040 16 0041 16 0042 16 0043 16 0044 16 0045 16 0046 16 0047 16 0048 16 0049 16 004a 16 004b 16 004c 16 004d 16 004e 16 004f 16 0050 16 0051 16 0052 16 0053 16 0054 16 0055 16 0056 16 0057 16 0058 16 0059 16 005a 16 005b 16 005c 16 005d 16 005e 16 005f 16 0060 16 0061 16 0062 16 0063 16 0064 16 0065 16 032a 16 032b 16 032c 16 032d 16 032e 16 032f 16 0330 16 0331 16 0332 16 0333 16 0334 16 0335 16 0336 16 0337 16 0338 16 0339 16 033a 16 033b 16 033c 16 033d 16 033e 16 033f 16 dma0 control register (dm0con) dma0 source pointer (sar0) dma0 transfer counter (tcr0) watchdog timer start register (wdts) watchdog timer control register (wdc) processor mode register 0 (pm0) address match interrupt register 0 (rmad0) address match interrupt register 1 (rmad1) chip select control register (csr) system clock control register 0 (cm0) system clock control register 1 (cm1) address match interrupt enable register (aier) protect register (prcr) processor mode register 1(pm1) dma0 destination pointer (dar0) timer a1 interrupt control register (ta1ic) uart0 transmit interrupt control register (s0tic) timer a0 interrupt control register (ta0ic) timer a2 interrupt control register (ta2ic) uart0 receive interrupt control register (s0ric) uart1 transmit interrupt control register (s1tic) uart1 receive interrupt control register (s1ric) dma0 interrupt control register (dm0ic) key input interrupt control register (kupic) a-d conversion interrupt control register (adic) bus collision detection interrupt control register (bcnic) uart2 transmit interrupt control register (s2tic) uart2 receive interrupt control register (s2ric) int1 interrupt control register (int1ic) timer b2 interrupt control register (tb2ic) int2 interrupt control register (int2ic) int0 interrupt control register (int0ic) timer b1 interrupt control register (tb1ic) note : locations in the sfr area where nothing is allocated are reserved areas. do not access these areas for read or write.
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r sfr 19 figure 1.6.2. location of peripheral unit control registers (2) 0380 16 0381 16 0382 16 0383 16 0384 16 0385 16 0386 16 0387 16 0388 16 0389 16 038a 16 038b 16 038c 16 038d 16 038e 16 038f 16 0390 16 0391 16 0392 16 0393 16 0394 16 0395 16 0396 16 0397 16 0398 16 0399 16 039a 16 039b 16 039c 16 039d 16 039e 16 039f 16 03a0 16 03a1 16 03a2 16 03a3 16 03a4 16 03a5 16 03a6 16 03a7 16 03a8 16 03a9 16 03aa 16 03ab 16 03ac 16 03ad 16 03ae 16 03af 16 03b0 16 03b1 16 03b2 16 03b3 16 03b4 16 03b5 16 03b6 16 03b7 16 03b8 16 03b9 16 03ba 16 03bb 16 03bc 16 03bd 16 03be 16 03bf 16 0340 16 0341 16 0342 16 0343 16 0344 16 0345 16 0346 16 0347 16 0348 16 0349 16 034a 16 034b 16 034c 16 034d 16 034e 16 034f 16 0350 16 0351 16 0352 16 0353 16 0354 16 0355 16 0356 16 0357 16 0358 16 0359 16 035a 16 035b 16 035c 16 035d 16 035e 16 035f 16 0360 16 0361 16 0362 16 0363 16 0364 16 0365 16 0366 16 0367 16 0368 16 0369 16 036a 16 036b 16 036c 16 036d 16 036e 16 036f 16 0370 16 0371 16 0372 16 0373 16 0374 16 0375 16 0376 16 0377 16 0378 16 0379 16 037a 16 037b 16 037c 16 037d 16 037e 16 037f 16 interrupt cause select register (ifsr) timer a0 register (ta0) timer a1 register (ta1) timer a2 register (ta2) timer b1 register (tb1) timer b2 register (tb2) count start flag (tabsr) one-shot start flag (onsf) timer a0 mode register (ta0mr) timer a1 mode register (ta1mr) timer a2 mode register (ta2mr) timer b1 mode register (tb1mr) timer b2 mode register (tb2mr) up-down flag (udf) trigger select register (trgsr) clock prescaler reset flag (cpsrf) uart0 transmit/receive mode register (u0mr) uart0 transmit buffer register (u0tb) uart0 receive buffer register (u0rb) uart1 transmit/receive mode register (u1mr) uart1 transmit buffer register (u1tb) uart1 receive buffer register (u1rb) uart0 bit rate generator (u0brg) uart0 transmit/receive control register 0 (u0c0) uart0 transmit/receive control register 1 (u0c1) uart1 bit rate generator (u1brg) uart1 transmit/receive control register 0 (u1c0) uart1 transmit/receive control register 1 (u1c1) dma0 request cause select register (dm0sl) uart2 special mode register (u2smr) uart2 receive buffer register (u2rb) uart2 transmit buffer register (u2tb) uart2 transmit/receive control register 0 (u2c0) uart2 transmit/receive mode register (u2mr) uart2 transmit/receive control register 1 (u2c1) uart2 bit rate generator (u2brg) uart transmit/receive control register 2 (ucon) uart2 special mode register 2(u2smr2) note : locations in the sfr area where nothing is allocated are reserved areas. do not access these areas for read or write. uart2 special mode register 3(u2smr3)
sfr 20 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.6.3. location of peripheral unit control registers (3) 03c0 16 03c1 16 03c2 16 03c3 16 03c4 16 03c5 16 03c6 16 03c7 16 03c8 16 03c9 16 03ca 16 03cb 16 03cc 16 03cd 16 03ce 16 03cf 16 03d0 16 03d1 16 03d2 16 03d3 16 03d4 16 03d5 16 03d6 16 03d7 16 03d8 16 03d9 16 03da 16 03db 16 03dc 16 03dd 16 03de 16 03df 16 03e0 16 03e1 16 03e2 16 03e3 16 03e4 16 03e5 16 03e6 16 03e7 16 03e8 16 03e9 16 03ea 16 03eb 16 03ec 16 03ed 16 03ee 16 03ef 16 03f0 16 03f1 16 03f2 16 03f3 16 03f4 16 03f5 16 03f6 16 03f7 16 03f8 16 03f9 16 03fa 16 03fb 16 03fc 16 03fd 16 03fe 16 03ff 16 a-d register 7 (ad7) a-d register 0 (ad0) a-d register 1 (ad1) a-d register 2 (ad2) a-d register 3 (ad3) a-d register 4 (ad4) a-d register 5 (ad5) a-d register 6 (ad6) port p0 register (p0) port p0 direction register (pd0) port p1 register (p1) port p1 direction register (pd1) port p2 register (p2) port p2 direction register (pd2) port p3 register (p3) port p3 direction register (pd3) port p4 register (p4) port p4 direction register (pd4) port p5 register (p5) port p5 direction register (pd5) port p6 register (p6) port p6 direction register (pd6) port p7 register (p7) port p7 direction register (pd7) port p8 register (p8) port p8 direction register (pd8) port p9 register (p9) port p9 direction register (pd9) port p10 register (p10) port p10 direction register (pd10) pull-up control register 0 (pur0) pull-up control register 1 (pur1) pull-up control register 2 (pur2) a-d control register 0 (adcon0) a-d control register 1 (adcon1) a-d control register 2 (adcon2) port control register (pcr) note : locations in the sfr area where nothing is allocated are reserved areas. do not access these areas for read or write.
software reset 21 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r software reset writing 1 to bit 3 of the processor mode register 0 (address 0004 16 ) applies a (software) reset to the microcomputer. a software reset has the same effect as a hardware reset. the contents of internal ram are preserved. software reset processor mode (1) types of processor mode one of three processor modes can be selected: single-chip mode, memory expansion mode, and micro- processor mode. the functions of some pins, the memory map, and the access space differ according to the selected processor mode. single-chip mode in single-chip mode, only internal memory space (sfr, internal ram, and internal rom) can be accessed. however, after the reset has been released and the operation of shifting from the micropro- cessor mode has started (h applied to the cnv ss pin), the internal rom area cannot be accessed even if the cpu shifts to the single-chip mode. ports p0 to p10 can be used as programmable i/o ports or as i/o ports for the internal peripheral functions. memory expansion mode in memory expansion mode, external memory can be accessed in addition to the internal memory space (sfr, internal ram, and internal rom). however, after the reset has been released and the operation of shifting from the microprocessor mode has started (h applied to the cnv ss pin), the internal rom area cannot be accessed even if the cpu shifts to the memory expansion mode. in this mode, some of the pins function as the address bus, the data bus, and as control signals. the number of pins assigned to these functions depends on the bus and register settings. (see bus settings for details.) microprocessor mode in microprocessor mode, the sfr, internal ram, and external memory space can be accessed. the internal rom area cannot be accessed. in this mode, some of the pins function as the address bus, the data bus, and as control signals. the number of pins assigned to these functions depends on the bus width and register settings. (see bus settings for details.) (2) setting processor modes the processor mode is set using the cnv ss pin and the processor mode bits (bits 1 and 0 at address 0004 16 ). do not set the processor mode bits to 10 2 . regardless of the level of the cnv ss pin, changing the processor mode bits selects the mode. therefore, never change the processor mode bits when changing the contents of other bits. do not change the processor mode bits simultaneously with other bits when changing the processor mode bits 01 2 or 11 2 . change the processor mode bits after changing the other bits. also do not attempt to shift to or from the microprocessor mode within the program stored in the internal rom area. applying v ss to cnv ss pin the microcomputer begins operation in single-chip mode after being reset. memory expansion mode is selected by writing 01 2 to the processor mode bits. applying v cc to cnv ss pin the microcomputer starts to operate in microprocessor mode after being reset.
processor mode 22 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.7.1. processor mode register 0 and 1 processor mode register 0 (note 1) symbol address when reset pm0 0004 16 00 16 (note 2) bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 0 0: single-chip mode 0 1: memory expansion mode 1 0: must not be set 1 1: microprocessor mode b1 b0 pm03 pm01 pm00 processor mode bit pm02 r/w mode select bit 0 : rd,bhe,wr 1 : rd,wrh,wrl software reset bit the device is reset when this bit is set to 1. the value of this bit is 0 when read. pm04 0 0 : multiplexed bus is not used 0 1 : allocated to cs2 space 1 0 : allocated to cs1 space 1 1 : allocated to entire space (note4) b5 b4 multiplexed bus space select bit pm05 pm06 pm07 port p4 0 to p4 3 function select bit (note 3) 0 : address output 1 : port function (address is not output) bclk output disable bit 0 : bclk is output 1 : bclk is not output (pin is left floating) note 1: set bit 1 of the protect register (address 000a 16 ) to 1 when writing new values to this register. note 2: if the v cc voltage is applied to the cnv ss , the value of this register when reset is 03 16 . (pm00 and pm01 both are set to 1.) note 3: valid in microprocessor and memory expansion modes. note 4: if the entire space is of multiplexed bus in memory expansion mode, choose an 8- bit width.the processor operates using the separate bus after reset is revoked, so the entire space multiplexed bus cannot be chosen in microprocessor mode. p3 1 to p3 7 become a port if the entire space multiplexed bus is chosen, so only 256 bytes can be used in each chip select. processor mode register 1 (note) symbol address when reset pm1 0005 16 00000xx0 2 bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 nothing is assigned. in an attempt to write to these bits, write 0. the value, if read, turns out to be indeterminate. reserved bit must always be set to 0 0 note: set bit 1 of the protect register (address 000a 16 ) to 1 when writing new values to this register. aa aa a a aa aa a a aa aa a a aa a aa a aa a aa a aa a aa aa a a pm17 wait bit 0 : no wait state 1 : wait state inserted aa aa a a aa a a reserved bit must always be set to 0 0 aa 00 aa aa a a reserved bit must always be set to 0 aa a reserved bit must always be set to 0 reserved bit must always be set to 0 0 figure 1.7.1 shows the processor mode register 0 and 1. figure 1.7.2 shows the memory maps in each processor modes.
processor mode 23 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r single-chip mode sfr area internal ram area inhibited internal rom area microprocessor mode sfr area internal ram area external area internally reserved area 00000 16 00400 16 xxxxx 16 yyyyy 16 fffff 16 d0000 16 external area : accessing this area allows the user to access a device connected externally to the microcomputer. 04000 16 memory expansion mode sfr area internal ram area external area internal rom area internally reserved area internally reserved area address yyyyy 16 2k bytes 00bff 16 00fff 16 address xxxxx 16 rom size 3k bytes ram size 32k bytes e8000 16 f0000 16 e0000 16 96k bytes 64k bytes 128k bytes f8000 16 figure 1.7.2. memory maps in each processor modes
bus settings 24 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r bus settings the byte pin and bits 4 to 6 of the processor mode register 0 (address 0004 16 ) are used to change the bus settings. table 1.8.1 shows the factors used to change the bus settings. bus setting switching factor switching external address bus width bit 6 of processor mode register 0 switching external data bus width byte pin switching between separate and multiplex bus bits 4 and 5 of processor mode register 0 (1) selecting external address bus width the address bus width for external output in the 1m bytes of address space can be set to 16 bits (64k bytes address space) or 20 bits (1m bytes address space). when bit 6 of the processor mode register 0 is set to 1, the external address bus width is set to 16 bits, and p2 and p3 become part of the address bus. p4 0 to p4 3 can be used as programmable i/o ports. when bit 6 of processor mode register 0 is set to 0, the external address bus width is set to 20 bits, and p2, p3, and p4 0 to p4 3 become part of the address bus. (2) selecting external data bus width the external data bus width can be set to 8 or 16 bits. (note, however, that only the separate bus can be set.) when the byte pin is l, the bus width is set to 16 bits; when h, it is set to 8 bits. (the internal bus width is permanently set to 16 bits.) while operating, fix the byte pin either to h or to l. (3) selecting separate/multiplex bus the bus format can be set to multiplex or separate bus using bits 4 and 5 of the processor mode register 0. separate bus in this mode, the data and address are input and output separately. the data bus can be set using the byte pin to be 8 or 16 bits. when the byte pin is h, the data bus is set to 8 bits and p0 functions as the data bus and p1 as a programmable i/o port. when the byte pin is l, the data bus is set to 16 bits and p0 and p1 are both used for the data bus. when the separate bus is used for access, a software wait can be selected. multiplex bus in this mode, data and address i/o are time multiplexed. with the byte pin = h, the 8 bits from d 0 to d 7 are multiplexed with a 0 to a 7 . with the byte pin = l, the 8 bits from d 0 to d 7 are multiplexed with a 1 to a 8 . d 8 to d 15 are not multiplexed. in this case, the external devices connected to the multiplexed bus are mapped to the microcomputers even addresses (every 2nd address). to access these external devices, access the even addresses as bytes. the ale signal latches the address. it is output from p5 6 . before using the multiplex bus for access, be sure to insert a software wait. if the entire space is of multiplexed bus in memory expansion mode, choose an 8-bit width. the processor operates using the separate bus after reset is revoked, so the entire space multiplexed bus cannot be chosen in microprocessor mode. p3 1 to p3 7 become a port if the entire space multiplexed bus is chosen, so only 256 bytes can be used in each chip select. table 1.8.1. factors for switching bus settings
bus settings 25 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r p5 6 i/o port ale ale ale ale ale p5 7 i/o port rdy rdy rdy rdy rdy p0 0 to p0 7 i/o port data bus data bus data bus data bus i/o port either cs1 or cs2 is for multiplexed bus and others are for separate bus (separate bus) multiplexed bus for the entire space single-chip mode memory expansion mode/microprocessor modes memory expansion mode data bus width byte pin level port p4 0 to p4 3 function select bit = 0 01, 10 00 11 (note 1) 8 bit h 8 bits h 16 bits l 8 bits h 16 bits l note 1: if the entire space is of multiplexed bus in memory expansion mode, choose an 8-bit width. the processor operates using the separate bus after reset is revoked, so the entire space multiplexed bus cannot be chosen in microprocessor mode. p3 1 to p3 7 become a port if the entire space multiplexed bus is chosen, so only 256 bytes can be used in each chip select. note 2: address bus when in separate bus mode. processor mode multiplexed bus space select bit cs (chip select) or programmable i/o port (for details, refer to bus control) outputs rd, wrl, wrh, and bclk or rd, bhe, wr, and bclk (for details, refer to bus control) port p4 0 to p4 3 function select bit = 1 p1 0 to p1 7 i/o port i/o port data bus i/o port data bus i/o port p2 1 to p2 7 i/o port address bus address bus address bus address bus address bus /data bus (note 2) /data bus (note 2) /data bus p2 0 i/o port address bus address bus address bus address bus address bus /data bus (note 2) /data bus p3 0 i/o port address bus address bus address bus address bus a 8 /d 7 /data bus (note 2) p3 1 to p3 7 i/o port address bus address bus address bus address bus i/o port p4 0 to p4 3 i/o port i/o port i/o port i/o port i/o port i/o port p4 0 to p4 3 i/o port address bus address bus address bus address bus i/o port p4 4 to p4 7 i/o port p5 0 to p5 3 i/o port p5 4 i/o port hlda hlda hlda hlda hlda p5 5 i/o port hold hold hold hold hold table 1.8.2. pin functions for each processor mode
bus control 26 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r bus control the following explains the signals required for accessing external devices and software waits. the signals required for accessing the external devices are valid when the processor mode is set to memory expansion mode and microprocessor mode. the software waits are valid in all processor modes. (1) address bus/data bus the address bus consists of the 20 pins a 0 to a 19 for accessing the 1m bytes of address space. the data bus consists of the pins for data i/o. when the byte pin is h, the 8 ports d 0 to d 7 function as the data bus. when byte is l, the 16 ports d 0 to d 15 function as the data bus. when a change is made from single-chip mode to memory expansion mode, the value of the address bus is undefined until external memory is accessed. (2) chip select signal the chip select signal is output using the same pins as p4 4 to p4 7 . bits 0 to 3 of the chip select control register (address 0008 16 ) set each pin to function as a port or to output the chip select signal. the chip select control register is valid in memory expansion mode and microprocessor mode. in single-chip mode, p4 4 to p4 7 function as programmable i/o ports regardless of the value in the chip select control register. _______ in microprocessor mode, only cs0 outputs the chip select signal after the reset state has been can- _______ _______ celled. cs1 to cs3 function as input ports. figure 1.9.1 shows the chip select control register. the chip select signal can be used to split the external area into as many as four blocks. tables 1.9.1 shows the external memory areas specified using the chip select signal. processor mode memory expansion mode chip select signal cs0 cs1 cs2 cs3 30000 16 to cffff 16 (640k bytes) microprocessor mode 28000 16 to 2ffff 16 (32k bytes) 08000 16 to 27fff 16 (128k bytes) 04000 16 to 07fff 16 (16k bytes) 30000 16 to fffff 16 (832k bytes) table 1.9.1. external areas specified by the chip select signals
bus control 27 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r w function bit symbol bit name chip select control register symbol address when reset csr 0008 16 01 16 r b7 b6 b5 b4 b3 b2 b1 b0 cs1 cs0 cs3 cs2 cs0 output enable bit cs1 output enable bit cs2 output enable bit cs3 output enable bit cs1w cs0w cs3w cs2w cs0 wait bit cs1 wait bit cs2 wait bit cs3 wait bit 0 : chip select output disabled (normal port pin) 1 : chip select output enabled 0 : wait state inserted 1 : no wait state a a aa aa a aa a aa a a aa aa a aa a a aa aa a aa a aa figure 1.9.1. chip select control register the timing of the chip select signal changing to l(active) is synchronized with the address bus. but the timing of the chip select signal changing to h depends on the area which will be accessed in the next cycle. figure 1.9.2 shows the output example of the address bus and chip select signal.
bus control 28 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.9.2. output examples about address bus and chip select signal (separated bus without wait) example 1) after access the external area, both the address signal and the chip select signal change concurrently in the next cycle. in this example, after access to the external area(i), an access to the area indicated by the other chip select signal(j) will occur in the next cycle. in this case, both the address bus and the chip select signal change between the two cycles. note : these examples show the address bus and chip select signal within the successive two cycles. according to the combination of these examples, the chip select can be elongated to over 2cycles. bclk read/write signal data bus address bus chip select (cs i) access to the external area( i ) chip select (cs j) access to the other external area( j ) address data example 2) after access the external area, only the chip select signal changes in the next cycle (the address bus does not change). in this example, an access to the internal rom or the internal ram in the next cycle will occur, after access to the external area. in this case, the chip select signal changes between the two cycles, but the address does not change. example 4) after access the external area, either the address signal and the chip select signal do not change in the next cycle. in this example, any access to any area does not occur in the next cycle (either instruction prefetch does not occur). in this case,either the address bus and chip select signal do not change between the two cycles. example 3) after access the external area, only the address bus changes in the next cycle (the chip select signal does not change). in this example, after access to the external area(i), an access to the area indicated by the same chip select signal(i) will occur in the next cycle. in this case, the address bus changes between the two cycles, but the chip select signal does not change. bclk access to the external area internal rom/ram access read/write signal data bus address bus chip select address data bclk access to the external area no access read/write signal data bus address bus chip select address data bclk access to the external area( i ) access to the same external area( i ) read/write signal data bus address bus chip select (cs i) address data
bus control 29 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r _____ ______ ________ table 1.9.4. operation of rd, wr, and bhe signals status of external data bus rd bhe wr hll lhl hlh lhh write 1 byte of data to odd address read 1 byte of data from odd address write 1 byte of data to even address read 1 byte of data from even address data bus width a0 h h l l hll l lhl l hl h / l lh h / l 8-bit (byte = h) write data to both even and odd addresses read data from both even and odd addresses write 1 byte of data read 1 byte of data 16-bit (byte = l) not used not used status of external data bus read data write 1 byte of data to even address write 1 byte of data to odd address write data to both even and odd addresses wrh wrl rd data bus width 16-bit (byte = l) h h h h l h l h h l l l _____ ________ _________ table 1.9.3. operation of rd, wrl, and wrh signals (3) read/write signals with a 16-bit data bus (byte pin =l), bit 2 of the processor mode register 0 (address 0004 16 ) select the _____ ________ ______ _____ ________ _________ combinations of rd, bhe, and wr signals or rd, wrl, and wrh signals. with an 8-bit data bus (byte _____ ______ _______ pin = h), use the combination of rd, wr, and bhe signals. (set bit 2 of the processor mode register 0 (address 0004 16 ) to 0.) tables 1.9.3 and 1.9.4 show the operation of these signals. _____ ______ ________ after a reset has been cancelled, the combination of rd, wr, and bhe signals is automatically selected. _____ _________ _________ when switching to the rd, wrl, and wrh combination, do not write to external memory until bit 2 of the processor mode register 0 (address 0004 16 ) has been set (note). note: before attempting to change the contents of the processor mode register 0, set bit 1 of the protect register (address 000a 16 ) to 1. (4) ale signal the ale signal latches the address when accessing the multiplex bus space. latch the address when the ale signal falls. when byte pin = h when byte pin = l ale address data (note 1) address (note 2) d 0 /a 0 to d 7 /a 7 a 8 to a 19 ale address data (note 1) address d 0 /a 1 to d 7 /a 8 a 9 to a 19 address a 0 note 1: floating when reading. note 2: when multiplexed bus for the entire space is selected, these are i/o ports. figure 1.9.3. ale signal and address/data bus
bus control 30 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r _____ ________ figure 1.9.4. example of rd signal extended by rdy signal bclk rd cs i (i=0 to 3) rdy tsu(rdy - bclk) aaaa bclk rd cs i (i=0 to 3) rdy tsu(rdy - bclk) aaaaaa aaaaaa aa aa in an instance of separate bus in an instance of multiplexed bus accept timing of rdy signal : wait using rdy signal : wait using software accept timing of rdy signal ________ note: the rdy signal cannot be received immediately prior to a software wait. table 1.9.5. microcomputer status in wait state (note) item status oscillation on ___ _____ r/w signal, address bus, data bus, cs ________ maintain status when rdy signal received __________ ale signal, hlda, programmable i/o ports internal peripheral circuits on ________ (5) the rdy signal ________ rdy is a signal that facilitates access to an external device that requires long access time. as shown in ________ figure 1.9.4, if an l is being input to the rdy at the bclk falling edge, the bus turns to the wait state. if ________ an h is being input to the rdy pin at the bclk falling edge, the bus cancels the wait state. table 1.9.5 shows the state of the microcomputer with the bus in the wait state, and figure 1.9.4 shows an example ____ ________ in which the rd signal is prolonged by the rdy signal. ________ the rdy signal is valid when accessing the external area during the bus cycle in which bits 4 to 7 of the ________ chip select control register (address 0008 16 ) are set to 0. the rdy signal is invalid when setting 1 to ________ all bits 4 to 7 of the chip select control register (address 0008 16 ), but the rdy pin should be treated as properly as in non-using.
bus control 31 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r table 1.9.6. microcomputer status in hold state item status oscillation on ___ _____ _______ r/w signal, address bus, data bus, cs, bhe floating programmable i/o ports p0, p1, p2, p3, p4, p5 floating p6, p7, p8, p9, p10 m aintains status when hold signal is received __________ hlda output l internal peripheral circuits on (but watchdog timer stops) ale signal undefined __________ hold > dmac > cpu (6) hold signal the hold signal is used to transfer the bus privileges from the cpu to the external circuits. inputting l to __________ the hold pin places the microcomputer in the hold state at the end of the current bus access. this status __________ __________ is maintained and l is output from the hlda pin as long as l is input to the hold pin. table 1.9.6 shows the microcomputer status in the hold state. __________ bus-using priorities are given to hold, dmac, and cpu in order of decreasing precedence. figure 1.9.5. bus-using priorities (7) external bus status when the internal area is accessed table 1.9.7 shows the external bus status when the internal area is accessed. table 1.9.7. external bus status when the internal area is accessed item sfr accessed internal rom/ram accessed address bus address output maintain status before accessed address of external area data bus when read floating floating when write output data undefined rd, wr, wrl, wrh rd, wr, wrl, wrh output output h bhe bhe output maintain status before accessed status of external area cs output h output h ale output l output l
bus control 32 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r (9) software wait a software wait can be inserted by setting the wait bit (bit 7) of the processor mode register 1 (address 0005 16 ) (note) and bits 4 to 7 of the chip select control register (address 0008 16 ). a software wait is inserted in the internal rom/ram area and in the external memory area by setting the wait bit of the processor mode register 1. when set to 0, each bus cycle is executed in one bclk cycle. when set to 1, each bus cycle is executed in two or three bclk cycles. after the microcomputer has been reset, this bit defaults to 0. when set to 1, a wait is applied to all memory areas (two or three bclk cycles), regardless of the contents of bits 4 to 7 of the chip select control register . set this bit after referring to the recommended operating conditions (main clock input oscillation frequency) of the electric character- ________ istics. however, when the user is using the rdy signal, the relevant bit in the chip select control registers bits 4 to 7 must be set to 0. when the wait bit of the processor mode register 1 is 0, software waits can be set independently for each of the 4 areas selected using the chip select signal. bits 4 to 7 of the chip select control register _______ _______ correspond to chip selects cs0 to cs3. when one of these bits is set to 1, the bus cycle is executed in one bclk cycle. when set to 0, the bus cycle is executed in two or three bclk cycles. these bits default to 0 after the microcomputer has been reset. the sfr area is always accessed in two bclk cycles regardless of the setting of these control bits. also, insert a software wait if using the multiplex bus to access the external memory area. table 1.9.8 shows the software wait and bus cycles. figure 1.9.6 shows example of bus timing when using software waits. note: before attempting to change the contents of the processor mode register 1, set bit 1 of the protect register (address 000a 16 ) to 1. area bus status wait bit bits 4 to 7 of chip select control register bus cycle invalid 1 2 bclk cycles external memory area separate bus 0 1 1 bclk cycle separate bus 0 0 2 bclk cycles separate bus 1 0 (note) 2 bclk cycles multiplex bus 0 0 3 bclk cycles multiplex bus 1 3 bclk cycles 0 (note) sfr internal rom/ram 0 invalid 1 bclk cycle invalid invalid 2 bclk cycles note: when using the rdy signal, always set to 0. table 1.9.8. software waits and bus cycles (8) bclk output the user can choose the bclk output by use of bit 7 of processor mode register 0 (0004 16 ) (note). when set to 1, the output floating. note: before attempting to change the contents of the processor mode register 0, set bit 1 of the protect register (address 000a 16 ) to 1.
bus control 33 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.9.6. typical bus timings using software wait output input address address < separate bus (with wait) > bclk read signal write signal data bus bclk read signal address bus/ data bus chip select (note 2) address address data output address address input ale < multiplexed bus > write signal bclk read signal write signal address bus (note 2) address address bus cycle (note 1) < separate bus (no wait) > output data bus input note 1: these example timing charts indicate bus cycle length. after this bus cycle sometimes come read and write cycles in succession. note 2: the address bus and chip select may be extended depending on the cpu status such as that of the instruction queue buffer. bus cycle (note 1) bus cycle (note 1) bus cycle (note 1) bus cycle (note 1) bus cycle (note 1) address bus (note 2) address bus (note 2) chip select (note 2) chip select (note 2)
clock generating circuit 34 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.10.2. examples of sub-clock table 1.10.1. main clock and sub-clock generating circuits clock generating circuit the clock generating circuit contains two oscillator circuits that supply the operating clock sources to the cpu and internal peripheral units. example of oscillator circuit figure 1.10.1 shows some examples of the main clock circuit, one using an oscillator connected to the circuit, and the other one using an externally derived clock for input. figure 1.10.2 shows some examples of sub-clock circuits, one using an oscillator connected to the circuit, and the other one using an externally derived clock for input. circuit constants in figures 1.10.1 and 1.10.2 vary with each oscillator used. use the values recommended by the manufacturer of your oscillator. figure 1.10.1. examples of main clock main clock generating circuit sub-clock generating circuit use of clock ? cpus operating clock source ? cpus operating clock source ? internal peripheral units ? timer a/bs count clock operating clock source source usable oscillator ceramic or crystal oscillator crystal oscillator pins to connect oscillator x in , x out x cin , x cout oscillation stop/restart function available available oscillator status immediately after reset oscillating stopped other externally derived clock can be input microcomputer (built-in feedback resistor) x in x out externally derived clock open vcc vss microcomputer (built-in feedback resistor) x in x out r d c in c out (note) note: insert a damping resistor if required. the resistance will vary depending on the oscillator and the oscillation drive capacity setting. use the value recommended by the maker of the oscillator. when the oscillation drive capacity is set to low, check that oscillation is stable. also, if the oscillator manufacturer's data sheet specifies that a feedback resistor be added external to the chip, insert a feedback resistor between x in and x out following the instruction. microcomputer (built-in feedback resistor) x cin x cout externally derived clock open vcc vss note: insert a damping resistor if required. the resistance will vary depending on the oscillator and the oscillation drive capacity setting. use the value recommended by the maker of the oscillator. when the oscillation drive capacity is set to low, check that oscillation is stable. also, if the oscillator manufacturer's data sheet specifies that a feedback resistor be added external to the chip, insert a feedback resistor between x cin and x cout following the instruction. microcomputer (built-in feedback resistor) x cin x cout (note) c cin c cout r cd
clock generating circuit 35 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r clock control figure 1.10.3 shows the block diagram of the clock generating circuit. sub clock cm04 f c32 cm0i : bit i at address 0006 16 cm1i : bit i at address 0007 16 wdci : bit i at address 000f 16 x cin cm10 1 write signal 1/32 x cout q s r wait instruction x out main clock cm05 f c cm02 f 1 q s r nmi interrupt request level judgment output reset software reset f c cm07=0 cm07=1 f ad aaa aaa divider a d 1/2 1/2 1/2 1/2 cm06=0 cm17,cm16=00 cm06=0 cm17,cm16=01 cm06=0 cm17,cm16=10 cm06=1 cm06=0 cm17,cm16=11 d a details of divider x in f 8 f 32 c b b 1/2 c f 32sio2 f 8sio2 f 1sio2 bclk figure 1.10.3. clock generating circuit
clock generating circuit 36 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r the following paragraphs describes the clocks generated by the clock generating circuit. (1) main clock the main clock is generated by the main clock oscillation circuit. after a reset, the clock is divided by 8 to the bclk. the clock can be stopped using the main clock stop bit (bit 5 at address 0006 16 ). stopping the clock, after switching the operating clock source of cpu to the sub-clock, reduces the power dissipation. after the oscillation of the main clock oscillation circuit has stabilized, the drive capacity of the main clock oscillation circuit can be reduced using the x in -x out drive capacity select bit (bit 5 at address 0007 16 ). reducing the drive capacity of the main clock oscillation circuit reduces the power dissipation. this bit changes to 1 when shifting from high-speed/medium-speed mode to stop mode and at a reset. when shifting from low-speed/low power dissipation mode to stop mode, the value before stop mode is re- tained. (2) sub-clock the sub-clock is generated by the sub-clock oscillation circuit. no sub-clock is generated after a reset. after oscillation is started using the port x c select bit (bit 4 at address 0006 16 ), the sub-clock can be selected as the bclk by using the system clock select bit (bit 7 at address 0006 16 ). however, be sure that the sub-clock oscillation has fully stabilized before switching. after the oscillation of the sub-clock oscillation circuit has stabilized, the drive capacity of the sub-clock oscillation circuit can be reduced using the x cin -x cout drive capacity select bit (bit 3 at address 0006 16 ). reducing the drive capacity of the sub-clock oscillation circuit reduces the power dissipation. this bit changes to 1 when shifting to stop mode and at a reset. when the x cin /x cout is used, set ports p8 6 and p8 7 as the input ports without pull-up. (3) bclk the bclk is the clock that drives the cpu, and is f c or the clock is derived by dividing the main clock by 1, 2, 4, 8, or 16. the bclk is derived by dividing the main clock by 8 after a reset. the bclk signal can be output from bclk pin by the bclk output disable bit (bit 7 at address 0004 16 ) in the memory expan- sion and the microprocessor modes. the main clock division select bit 0(bit 6 at address 0006 16 ) changes to 1 when shifting from high- speed/medium-speed to stop mode and at reset. when shifting from low-speed/low power dissipation mode to stop mode, the value before stop mode is retained. (4) peripheral function clock(f 1 , f 8 , f 32 , f 1sio2 , f 8sio2 ,f 32sio2 ,f ad ) the clock for the peripheral devices is derived from the main clock or by dividing it by 1, 8, or 32. the peripheral function clock is stopped by stopping the main clock or by setting the wait peripheral function clock stop bit (bit 2 at 0006 16 ) to 1 and then executing a wait instruction. (5) f c32 this clock is derived by dividing the sub-clock by 32. it is used for the timer a and timer b counts. (6) f c this clock has the same frequency as the sub-clock. it is used for the bclk and for the watchdog timer.
clock generating circuit 37 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.10.4 shows the system clock control registers 0 and 1. figure 1.10.4. clock control registers 0 and 1 system clock control register 0 (note 1) symbol address when reset cm0 0006 16 48 16 bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 0 0 : i/o port p5 7 0 1 : f c output 1 0 : f 8 output 1 1 : f 32 output b1 b0 cm07 cm05 cm04 cm03 cm01 cm02 cm00 cm06 clock output function select bit (valid only in single-chip mode) wait peripheral function clock stop bit 0 : do not stop peripheral function clock in wait mode 1 : stop peripheral function clock in wait mode (note 8) x cin -x cout drive capacity select bit (note 2) 0 : low 1 : high port x c select bit 0 : i/o port 1 : x cin -x cout generation (note 9) main clock (x in -x out ) stop bit (note 3, 4, 5) 0 : on 1 : off main clock division select bit 0 (note 7) 0 : cm16 and cm17 valid 1 : division by 8 mode system clock select bit (note 6) 0 : x in , x out 1 : x cin , x cout note 1: set bit 0 of the protect register (address 000a 16 ) to 1 before writing to this register. note 2: changes to 1 when shiffing to stop mode and at a reset. note 3: when entering low power dissipation mode, main clock stops by using this bit. to stop the main clock, when the sub clock oscillation is stable, set system clock select bit (cm07) to 1 before setting this bit to 1. note 4: when inputting external clock, only clock oscillation buffer is stopped and clock input is acceptable. note 5: if this bit is set to 1, x out turns h. the built-in feedback resistor remains being connected, so x in turns pulled up to x out (h) via the feedback resistor. note 6: set port x c select bit (cm04) to 1 and stabilize the sub-clock oscillating before setting this bit from 0 to 1. do not write to both bits at the same time. and also, set the main clock stop bit (cm05) to 0 and stabilize the main clock oscillating before setting this bit from 1 to 0. note 7: this bit changes to 1 when shifting from high-speed/medium-speed mode to stop mode and at a reset. when shifting from low-speed/low power dissipation mode to stop mode, the value before stop mode is retained. note 8: f c32 is not included. do not set to 1 when using low-speed or low power dissipation mode. note 9: when the x cin /x cout is used, set ports p8 6 and p8 7 as the input ports without pull-up. system clock control register 1 (note 1) symbol address when reset cm1 0007 16 20 16 bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 cm10 all clock stop control bit (note4) 0 : clock on 1 : all clocks off (stop mode) note 1: set bit 0 of the protect register (address 000a 16 ) to 1 before writing to this register. note 2: this bit changes to 1 when shifting from high-speed/medium-speed mode to stop mode and at a reset. when shifting from low-speed/low power dissipation mode to stop mode, the value before stop mode is retained. note 3: can be selected when bit 6 of the system clock control register 0 (address 0006 16 ) is 0. if 1, division mode is fixed at 8. note 4: if this bit is set to 1, x out turns h, and the built-in feedback resistor is cut off. x cin and x cout turn high- impedance state. cm15 x in -x out drive capacity select bit (note 2) 0 : low 1 : high w r w r cm16 cm17 reserved bit must always be set to 0 reserved bit must always be set to 0 main clock division select bit 1 (note 3) 0 0 : no division mode 0 1 : division by 2 mode 1 0 : division by 4 mode 1 1 : division by 16 mode b7 b6 0 0 reserved bit must always be set to 0 reserved bit must always be set to 0 0 0 aa a aa aa a a aa aa a a aa aa a a aa a aa a aa a aa a aa a aa a aa a aa aa a a aa aa a a aa a aa aa a a
clock generating circuit 38 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r pin memory expansion mode single-chip mode microprocessor mode _______ _______ address bus, data bus, cs0 to cs3, retains status before stop mode ________ bhe _____ ______ ________ _________ rd, wr, wrl, wrh h __________ hlda, bclk h ale h port retains status before stop mode retains status before stop mode clk out when fc selected valid only in single-chip mode h when f 8 , f 32 selected valid only in single-chip mode retains status before stop mode table 1.10.2. port status during stop mode clock output in single-chip mode, the clock output function select bits (bits 0 and 1 at address 0006 16 ) enable f 8 , f 32 , or fc to be output from the p5 7 /clk out pin. when the wait peripheral function clock stop bit (bit 2 at address 0006 16 ) is set to 1, the output of f 8 and f 32 stops when a wait instruction is executed. stop mode writing 1 to the all-clock stop control bit (bit 0 at address 0007 16 ) stops all oscillation and the microcom- puter enters stop mode. in stop mode, the content of the internal ram is retained provided that v cc re- mains above 2v. because the oscillation , bclk, f 1 to f 32 , f 1sio2 to f 32sio2 , f c , f c32 , and f ad stops in stop mode, peripheral functions such as the a-d converter and watchdog timer do not function. however, timer a and timer b operate provided that the event counter mode is set to an external pulse, and uarti(i = 0 to 2) functions provided an external clock is selected. table 1.10.2 shows the status of the ports in stop mode. stop mode is cancelled by a hardware reset or an interrupt. if an interrupt is to be used to cancel stop mode, that interrupt must first have been enabled, and the priority level of the interrupt which is not used to cancel must have been changed to 0. if returning by an interrupt, that interrupt routine is executed. if only a _______ hardware reset or an nmi interrupt is used to cancel stop mode, change the priority level of all interrupt to 0, then shift to stop mode. when shifting from high-speed/medium-speed mode to stop mode and at a reset, the main clock division select bit 0 (bit 6 at address 0006 16 ) is set to 1. when shifting from low-speed/low power dissipation mode to stop mode, the value before stop mode is retained.
wait mode 39 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r table 1.10.3. port status during wait mode pin memory expansion mode single-chip mode microprocessor mode _______ _______ address bus, data bus, cs0 to cs3, retains status before wait mode ________ bhe _____ ______ ________ _________ rd, wr, wrl, wrh h __________ hlda,bclk h ale h port retains status before wait mode retains status before wait mode clk out when f c selected valid only in single-chip mode does not stop when f 8 , f 32 selected valid only in single-chip mode does not stop when the wait peripheral function clock stop bit is 0. when the wait peripheral function clock stop bit is 1, the status immediately prior to entering wait mode is main- tained. wait mode when a wait instruction is executed, the bclk stops and the microcomputer enters the wait mode. in this mode, oscillation continues but the bclk and watchdog timer stop. writing 1 to the wait peripheral function clock stop bit and executing a wait instruction stops the clock being supplied to the internal peripheral functions, allowing power dissipation to be reduced. however, peripheral function clock f c32 does not stop so that the peripherals using f c32 do not contribute to the power saving. when the mcu running in low-speed or low power dissipation mode, do not enter wait mode with this bit set to 1. table 1.10.3 shows the status of the ports in wait mode. wait mode is cancelled by a hardware reset or an interrupt. if an interrupt is used to cancel wait mode, that interrupt must first have been enabled, and the priority level of the interrupt which is not used to cancel must have been changed to 0. if returning by an interrupt, the clock in which the wait instruction executed is set to bclk by the microcomputer, and the action is resumed from the interrupt routine. if only a hardware _______ reset or an nmi interrupt is used to cancel wait mode, change the priority level of all interrupt to 0,then shift to wait mode.
status transition of bclk 40 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r 01000 invalid division by 2 mode 10000 invalid division by 4 mode invalid invalid 0 1 0 invalid division by 8 mode 11000 invalid division by 16 mode 00000 invalid no-division mode invalid invalid 1 invalid 0 1 low-speed mode invalid invalid 1 invalid 1 1 low power dissipation mode status transition of bclk power dissipation can be reduced and low-voltage operation achieved by changing the count source for bclk. table 1.10.4 shows the operating modes corresponding to the settings of system clock control registers 0 and 1. when reset, the device starts in division by 8 mode. the main clock division select bit 0(bit 6 at address 0006 16 ) changes to 1 when shifting from high-speed/medium-speed to stop mode and at a reset. when shifting from low-speed/low power dissipation mode to stop mode, the value before stop mode is retained. the following shows the operational modes of bclk. (1) division by 2 mode the main clock is divided by 2 to obtain the bclk. (2) division by 4 mode the main clock is divided by 4 to obtain the bclk. (3) division by 8 mode the main clock is divided by 8 to obtain the bclk. when reset, the device starts operating from this mode. before the user can go from this mode to no division mode, division by 2 mode, or division by 4 mode, the main clock must be oscillating stably. when going to low-speed or lower power consumption mode, make sure the sub-clock is oscillating stably. (4) division by 16 mode the main clock is divided by 16 to obtain the bclk. (5) no-division mode the main clock is divided by 1 to obtain the bclk. (6) low-speed mode f c is used as the bclk. note that oscillation of both the main and sub-clocks must have stabilized before transferring from this mode to another or vice versa. at least 2 to 3 seconds are required after the sub- clock starts. therefore, the program must be written to wait until this clock has stabilized immediately after powering up and after stop mode is cancelled. (7) low power dissipation mode f c is the bclk and the main clock is stopped. note : before the count source for bclk can be changed from x in to x cin or vice versa, the clock to which the count source is going to be switched must be oscillating stably. allow a wait time in software for the oscillation to stabilize before switching over the clock. cm17 cm16 cm07 cm06 cm05 cm04 operating mode of bclk table 1.10.4. operating modes dictated by settings of system clock control registers 0 and 1 cm1i : bit i of the address 0007 16 cm0i : bit i of the address 0006 16
power control 41 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r power control the following is a description of the three available power control modes: modes power control is available in three modes. (a) normal operation mode high-speed mode divide-by-1 frequency of the main clock becomes the bclk. the cpu operates with the bclk. each peripheral function operates according to its assigned clock. medium-speed mode divide-by-2, divide-by-4, divide-by-8, or divide-by-16 frequency of the main clock becomes the bclk. the cpu operates with the bclk. each peripheral function operates according to its as- signed clock. low-speed mode f c becomes the bclk. the cpu operates according to the f c clock. the f c clock is supplied by the subclock. each peripheral function operates according to its assigned clock. low power dissipation mode the main clock operating in low-speed mode is stopped. the cpu operates according to the f c clock. the f c clock is supplied by the subclock. the only peripheral functions that operate are those with the subclock selected as the count source. (b) wait mode the cpu operation is stopped. the oscillators do not stop. (c) stop mode all oscillators stop. the cpu and all built-in peripheral functions stop. this mode, among the three modes listed here, is the most effective in decreasing power consumption. figure 1.10.5 is the state transition diagram of the above modes.
power control 42 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.10.5. state transition diagram of power control mode transition of stop mode, wait mode transition of normal mode reset medium-speed mode (divided-by-8 mode) interrupt cm10 = 1 all oscillators stopped cpu operation stopped medium-speed mode (divided-by-8 mode) bclk : f(x in )/8 cm07 = 0 cm06 = 1 low-speed mode high-speed mode main clock is oscillating sub clock is stopped main clock is oscillating sub clock is stopped main clock is stopped sub clock is oscillating main clock is oscillating sub clock is oscillating low power dissipation mode high-speed/medium- speed mode low-speed/low power dissipation mode normal mode stop mode stop mode stop mode all oscillators stopped all oscillators stopped wait mode wait mode wait mode cpu operation stopped cpu operation stopped interrupt wait instruction interrupt wait instruction interrupt wait instruction cm10 = 1 interrupt interrupt cm10 = 1 bclk : f(x in )/2 cm07 = 0 cm06 = 0 cm17 = 0 cm16 = 1 medium-speed mode (divided-by-2 mode) bclk : f(x in )/16 cm07 = 0 cm06 = 0 cm17 = 1 cm16 = 1 medium-speed mode (divided-by-16 mode) bclk : f(x in )/4 cm07 = 0 cm06 = 0 cm17 = 1 cm16 = 0 medium-speed mode (divided-by-4 mode) bclk : f(x in ) cm07 = 0 cm06 = 0 cm17 = 0 cm16 = 0 bclk : f(x in )/8 medium-speed mode (divided-by-8 mode) cm07 = 0 cm06 = 1 high-speed mode bclk : f(x in )/2 cm07 = 0 cm06 = 0 cm17 = 0 cm16 = 1 medium-speed mode (divided-by-2 mode) bclk : f(x in )/16 cm07 = 0 cm06 = 0 cm17 = 1 cm16 = 1 medium-speed mode (divided-by-16 mode) bclk : f(x in )/4 cm07 = 0 cm06 = 0 cm17 = 1 cm16 = 0 medium-speed mode (divided-by-4 mode) bclk : f(x in ) cm07 = 0 cm06 = 0 cm17 = 0 cm16 = 0 bclk : f(x cin ) cm07 = 1 bclk : f(x cin ) cm07 = 1 main clock is oscillating sub clock is oscillating cm07 = 0 (note 1, 3) cm07 = 0 (note 1) cm06 = 1 cm04 = 0 cm07 = 1 (note 2) cm07 = 0 (note 1) cm06 = 0 (note 3) cm04 = 1 cm07 = 1 (note 2) cm05 = 1 cm05 = 0 cm05 = 1 cm04 = 0 cm04 = 1 cm06 = 0 (notes 1,3) cm06 = 1 cm04 = 0 cm04 = 1 (notes 1, 3) note 1: switch clock after oscillation of main clock is sufficiently stable. note 2: switch clock after oscillation of sub clock is sufficiently stable. note 3: change cm06 after changing cm17 and cm16. note 4: transit in accordance with arrow. (refer to the following for the transition of normal mode.)
protection 43 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r protection the protection function is provided so that the values in important registers cannot be changed in the event that the program runs out of control. figure 1.10.6 shows the protect register. the values in the processor mode register 0 (address 0004 16 ), processor mode register 1 (address 0005 16 ), system clock control reg- ister 0 (address 0006 16 ), system clock control register 1 (address 0007 16 ), port p9 direction register (ad- dress 03f3 16 ) can only be changed when the respective bit in the protect register is set to 1. therefore, important outputs can be allocated to port p9. if, after 1 (write-enabled) has been written to the port p9 direction register write-enable bit (bit 2 at address 000a 16 ), a value is written to any address, the bit automatically reverts to 0 (write-inhibited). however, the system clock control registers 0 and 1 write-enable bit (bit 0 at 000a 16 ) and processor mode register 0 and 1 write-enable bit (bit 1 at 000a 16 ) do not automatically return to 0 after a value has been written to an address. the program must therefore be written to return these bits to 0. protect register symbol address when reset prcr 000a 16 xxxxx000 2 bit name bit symbol b7 b6 b5 b4 b3 b2 b1 b0 0 : write-inhibited 1 : write-enabled prc1 prc0 prc2 enables writing to processor mode registers 0 and 1 (addresses 0004 16 and 0005 16 ) function 0 : write-inhibited 1 : write-enabled enables writing to system clock control registers 0 and 1 (addresses 0006 16 and 0007 16 ) enables writing to port p9 direction register (address 03f3 16 ) (note ) 0 : write-inhibited 1 : write-enabled w r nothing is assigned. in an attempt to write to these bits, write 0. the value, if read, turns out to be indeterminate. note: writing a value to an address after 1 is written to this bit returns the bit to 0 . other bits do not automatically return to 0 and they must therefore be reset by the program. a a a a a a a a figure 1.10.6. protect register
interrupt 44 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r ? maskable interrupt : an interrupt which can be enabled (disabled) by the interrupt enable flag (i flag) or whose interrupt priority can be changed by priority level. ? non-maskable interrupt : an interrupt which cannot be enabled (disabled) by the interrupt enable flag (i flag) or whose interrupt priority cannot be changed by priority level. figure 1.11.1. classification of interrupts interrupt ? ? ? ? ? ? ? ? ? software hardware ? ? ? ? ? special peripheral i/o (note) ? ? ? ? ? undefined instruction (und instruction) overflow (into instruction) brk instruction int instruction ? ? ? ? ? ? ? reset _______ nmi ________ dbc watchdog timer single step address matched note: peripheral i/o interrupts are generated by the peripheral functions built into the microcomputer system. overview of interrupt type of interrupts figure 1.11.1 lists the types of interrupts.
interrupt 45 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r software interrupts a software interrupt occurs when executing certain instructions. software interrupts are non-maskable interrupts. undefined instruction interrupt an undefined instruction interrupt occurs when executing the und instruction. overflow interrupt an overflow interrupt occurs when executing the into instruction with the overflow flag (o flag) set to 1. the following are instructions whose o flag changes by arithmetic: abs, adc, adcf, add, cmp, div, divu, divx, neg, rmpa, sbb, sha, sub brk interrupt a brk interrupt occurs when executing the brk instruction. int interrupt an int interrupt occurs when specifying one of software interrupt numbers 0 through 63 and execut- ing the int instruction. software interrupt numbers 0 through 31 are assigned to peripheral i/o inter- rupts, so executing the int instruction allows executing the same interrupt routine that a peripheral i/ o interrupt does. the stack pointer (sp) used for the int interrupt is dependent on which software interrupt number is involved. so far as software interrupt numbers 0 through 31 are concerned, the microcomputer saves the stack pointer assignment flag (u flag) when it accepts an interrupt request. if change the u flag to 0 and select the interrupt stack pointer (isp), and then execute an interrupt sequence. when returning from the interrupt routine, the u flag is returned to the state it was before the acceptance of interrupt re- quest. so far as software numbers 32 through 63 are concerned, the stack pointer does not make a shift.
interrupt 46 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r hardware interrupts hardware interrupts are classified into two types special interrupts and peripheral i/o interrupts. (1) special interrupts special interrupts are non-maskable interrupts. reset ____________ reset occurs if an l is input to the reset pin. _______ nmi interrupt _______ _______ an nmi interrupt occurs if an l is input to the nmi pin. ________ dbc interrupt this interrupt is exclusively for the debugger, do not use it in other circumstances. watchdog timer interrupt generated by the watchdog timer. single-step interrupt this interrupt is exclusively for the debugger, do not use it in other circumstances. with the debug flag (d flag) set to 1, a single-step interrupt occurs after one instruction is executed. address match interrupt an address match interrupt occurs immediately before the instruction held in the address indicated by the address match interrupt register is executed with the address match interrupt enable bit set to 1. if an address other than the first address of the instruction in the address match interrupt register is set, no address match interrupt occurs. (2) peripheral i/o interrupts a peripheral i/o interrupt is generated by one of built-in peripheral functions. built-in peripheral func- tions are dependent on classes of products, so the interrupt factors too are dependent on classes of products. the interrupt vector table is the same as the one for software interrupt numbers 0 through 31 the int instruction uses. peripheral i/o interrupts are maskable interrupts. bus collision detection interrupt this is an interrupt that the serial i/o bus collision detection generates. dma0 interrupt this is an interrupts that dma generates. key-input interrupt ___ a key-input interrupt occurs if an l is input to the ki pin. a-d conversion interrupt this is an interrupt that the a-d converter generates. uart0, uart1, uart2/nack transmission interrupt these are interrupts that the serial i/o transmission generates. uart0, uart1, uart2/ack reception interrupt these are interrupts that the serial i/o reception generates. timer a0 interrupt through timer a2 interrupt these are interrupts that timer a generates timer b1, timer b2 interrupt these are interrupts that timer b generates. ________ ________ int0 interrupt through int2 interrupt ______ ______ an int interrupt occurs if either a rising edge or a falling edge or a both edge is input to the int pin.
interrupt 47 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r interrupt source vector table addresses remarks address (l) to address (h) undefined instruction fffdc 16 to fffdf 16 interrupt on und instruction overflow fffe0 16 to fffe3 16 interrupt on into instruction brk instruction fffe4 16 to fffe7 16 if the vector contains ff 16 , program execution starts from the address shown by the vector in the variable vector table address match fffe8 16 to fffeb 16 there is an address-matching interrupt enable bit single step (note) fffec 16 to fffef 16 do not use watchdog timer ffff0 16 to ffff3 16 ________ dbc (note) ffff4 16 to ffff7 16 do not use _______ nmi ffff8 16 to ffffb 16 _______ external interrupt by input to nmi pin reset ffffc 16 to fffff 16 note: interrupts used for debugging purposes only. figure 1.11.2. format for specifying interrupt vector addresses aaaaaaaa aaaaaaaa mid address aaaaaaaa aaaaaaaa low address aaaaaaaa aaaaaaaa 0 0 0 0 high address aaaaaaaa aaaaaaaa 0 0 0 0 0 0 0 0 vector address + 0 vector address + 1 vector address + 2 vector address + 3 lsb msb interrupts and interrupt vector tables if an interrupt request is accepted, a program branches to the interrupt routine set in the interrupt vector table. set the first address of the interrupt routine in each vector table. figure 1.11.2 shows the format for specifying the address. two types of interrupt vector tables are available fixed vector table in which addresses are fixed and variable vector table in which addresses can be varied by the setting. fixed vector tables the fixed vector table is a table in which addresses are fixed. the vector tables are located in an area extending from fffdc 16 to fffff 16 . one vector table comprises four bytes. set the first address of interrupt routine in each vector table. table 1.11.1 shows the interrupts assigned to the fixed vector tables and addresses of vector tables. table 1.11.1. interrupts assigned to the fixed vector tables and addresses of vector tables
interrupt 48 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r table 1.11.2. interrupts assigned to the variable vector tables and addresses of vector tables software interrupt number interrupt source vector table address address (l) to address (h) remarks cannot be masked i flag +0 to +3 (note 1) brk instruction software interrupt number 0 note 1: address relative to address in interrupt table register (intb). note 2: when iic mode is selected, nack and ack interrupts are selected. cannot be masked i flag +108 to +111 (note 1) software interrupt number 27 +112 to +115 (note 1) software interrupt number 28 +116 to +119 (note 1) software interrupt number 29 +120 to +123 (note 1) software interrupt number 30 +124 to +127 (note 1) software interrupt number 31 +128 to +131 (note 1) software interrupt number 32 +252 to +255 (note 1) software interrupt number 63 to to timer b1 timer b2 int0 int1 int2 software interrupt +44 to +47 (note 1) software interrupt number 11 +52 to +55 (note 1) software interrupt number 13 +56 to +59 (note 1) software interrupt number 14 +68 to +71 (note 1) software interrupt number 17 +72 to +75 (note 1) software interrupt number 18 +76 to +79 (note 1) software interrupt number 19 +80 to +83 (note 1) software interrupt number 20 +84 to +87 (note 1) software interrupt number 21 +88 to +91 (note 1) software interrupt number 22 +92 to +95 (note 1) software interrupt number 23 +40 to +43 (note 1) software interrupt number 10 +60 to +63 (note 1) software interrupt number 15 +64 to +67 (note 1) software interrupt number 16 dma0 key input interrupt a-d uart0 transmit uart0 receive uart1 transmit uart1 receive timer a0 timer a1 timer a2 bus collision detection uart2 transmit/nack (note 2) uart2 receive/ack (note 2) variable vector tables the addresses in the variable vector table can be modified, according to the users settings. indicate the first address using the interrupt table register (intb). the 256-byte area subsequent to the ad- dress the intb indicates becomes the area for the variable vector tables. one vector table comprises four bytes. set the first address of the interrupt routine in each vector table. table 1.11.2 shows the interrupts assigned to the variable vector tables and addresses of vector tables.
interrupt 49 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r interrupt control descriptions are given here regarding how to enable or disable maskable interrupts and how to set the priority to be accepted. what is described here does not apply to non-maskable interrupts. enable or disable a maskable interrupt using the interrupt enable flag (i flag), interrupt priority level selec- tion bit, or processor interrupt priority level (ipl). whether an interrupt request is present or absent is indicated by the interrupt request bit. the interrupt request bit and the interrupt priority level selection bit are located in the interrupt control register of each interrupt. also, the interrupt enable flag (i flag) and the ipl are located in the flag register (flg). figure 1.11.3 shows the memory map of the interrupt control registers.
interrupt 50 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.11.3. interrupt control registers symbol address when reset intiic(i=0 to 2) 005d 16 to 005f 16 xx00x000 2 bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 a a aa aa ilvl0 ir pol nothing is assigned. in an attempt to write to these bits, write 0. the value, if read, turns out to be indeterminate. interrupt priority level select bit interrupt request bit polarity select bit reserved bit 0: interrupt not requested 1: interrupt requested 0 : selects falling edge 1 : selects rising edge must always be set to 0 ilvl1 ilvl2 note 1: this bit can only be accessed for reset (= 0), but cannot be accessed for set (= 1). note 2: to rewrite the interrupt control register, do so at a point that does not generate the interrupt request for that register. for details, see the precautions for interrupts. (note 1) interrupt control register (note 2) b7 b6 b5 b4 b3 b2 b1 b0 a aa aa a bit name function bit symbol w r symbol address when reset bcnic 004a 16 xxxxx000 2 dm0ic 004b 16 xxxxx000 2 kupic 004d 16 xxxxx000 2 adic 004e 16 xxxxx000 2 sitic(i=0 to 2) 0051 16 , 0053 16 , 004f 16 xxxxx000 2 siric(i=0 to 2) 0052 16 , 0054 16 , 0050 16 xxxxx000 2 taiic(i=0 to 2) 0055 16 to 0057 16 xxxxx000 2 tbiic(i=1, 2) 005b 16 , 005c 16 xxxxx000 2 ilvl0 ir interrupt priority level select bit interrupt request bit 0 : interrupt not requested 1 : interrupt requested ilvl1 ilvl2 nothing is assigned. in an attempt to write to these bits, write 0. the value, if read, turns out to be indeterminate. (note 1) note 1: this bit can only be accessed for reset (= 0), but cannot be accessed for set (= 1). note 2: to rewrite the interrupt control register, do so at a point that does not generate the interrupt request for that register. for details, see the precautions for interrupts. 0 0 0 : level 0 (interrupt disabled) 0 0 1 : level 1 0 1 0 : level 2 0 1 1 : level 3 1 0 0 : level 4 1 0 1 : level 5 1 1 0 : level 6 1 1 1 : level 7 b2 b1 b0 0 0 0 : level 0 (interrupt disabled) 0 0 1 : level 1 0 1 0 : level 2 0 1 1 : level 3 1 0 0 : level 4 1 0 1 : level 5 1 1 0 : level 6 1 1 1 : level 7 b2 b1 b0 0 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
interrupt 51 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r interrupt enable flag (i flag) the interrupt enable flag (i flag) controls the enabling and disabling of maskable interrupts. setting this flag to 1 enables all maskable interrupts; setting it to 0 disables all maskable interrupts. this flag is set to 0 after reset. interrupt request bit the interrupt request bit is set to 1 by hardware when an interrupt is requested. after the interrupt is accepted and jumps to the corresponding interrupt vector, the request bit is set to 0 by hardware. the interrupt request bit can also be set to 0 by software. (do not set this bit to 1). table 1.11.4. interrupt levels enabled according to the contents of the ipl table 1.11.3. settings of interrupt priority levels interrupt priority level select bit interrupt priority level priority order 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 level 0 (interrupt disabled) level 1 level 2 level 3 level 4 level 5 level 6 level 7 low high b2 b1 b0 enabled interrupt priority levels 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 interrupt levels 1 and above are enabled interrupt levels 2 and above are enabled interrupt levels 3 and above are enabled interrupt levels 4 and above are enabled interrupt levels 5 and above are enabled interrupt levels 6 and above are enabled interrupt levels 7 and above are enabled all maskable interrupts are disabled ipl 2 ipl 1 ipl 0 ipl interrupt priority level select bit and processor interrupt priority level (ipl) set the interrupt priority level using the interrupt priority level select bit, which is one of the component bits of the interrupt control register. when an interrupt request occurs, the interrupt priority level is compared with the ipl. the interrupt is enabled only when the priority level of the interrupt is higher than the ipl. therefore, setting the interrupt priority level to 0 disables the interrupt. table 1.11.3 shows the settings of interrupt priority levels and table 1.11.4 shows the interrupt levels enabled, according to the contents of the ipl. the following are conditions under which an interrupt is accepted: interrupt enable flag (i flag) = 1 interrupt request bit = 1 interrupt priority level > ipl the interrupt enable flag (i flag), the interrupt request bit, the interrupt priority select bit, and the ipl are independent, and they are not affected by one another.
interrupt 52 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r example 1: int_switch1: fclr i ; disable interrupts. and.b #00h, 0055h ; clear ta0ic int. priority level and int. request bit. nop ; four nop instructions are required when using hold function. nop fset i ; enable interrupts. example 2: int_switch2: fclr i ; disable interrupts. and.b #00h, 0055h ; clear ta0ic int. priority level and int. request bit. mov.w mem, r0 ; dummy read. fset i ; enable interrupts. example 3: int_switch3: pushc flg ; push flag register onto stack fclr i ; disable interrupts. and.b #00h, 0055h ; clear ta0ic int. priority level and int. request bit. popc flg ; enable interrupts. the reason why two nop instructions (four when using the hold function) or dummy read are inserted before fset i in examples 1 and 2 is to prevent the interrupt enable flag i from being set before the interrupt control register is rewritten due to effects of the instruction queue. rewrite the interrupt control register to rewrite the interrupt control register, do so at a point that does not generate the interrupt request for that register. if there is possibility of the interrupt request occur, rewrite the interrupt control register after the interrupt is disabled. the program examples are described as follow: when changing an interrupt control register in a sate of interrupts being disabled, please read the following precautions on instructions used before changing the register. changing a non-interrupt request bit if an interrupt request for an interrupt control register is generated during an instruction to rewrite the register is being executed, there is a case that the interrupt request bit is not set and consequently the interrupt is ignored. this will depend on the instruction. if this creates problems, use the below instruc- tions to change the register. instructions : and, or, bclr, bset changing the interrupt request bit when attempting to clear the interrupt request bit of an interrupt control register, the interrupt request bit is not cleared sometimes. this will depend on the instruction. if this creates problems, use the below instructions to change the register. instructions : mov
interrupt 53 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r interrupt sequence an interrupt sequence what are performed over a period from the instant an interrupt is accepted to the instant the interrupt routine is executed is described here. if an interrupt occurs during execution of an instruction, the processor determines its priority when the execution of the instruction is completed, and transfers control to the interrupt sequence from the next cycle. if an interrupt occurs during execution of either the smovb, smovf, sstr or rmpa instruction, the processor temporarily suspends the instruction being executed, and transfers control to the interrupt sequence. in the interrupt sequence, the processor carries out the following in sequence given: (1) cpu gets the interrupt information (the interrupt number and interrupt request level) by reading ad- dress 00000 16 . after this, the corresponding interrupt request bit becomes 0. (2) saves the content of the flag register (flg) as it was immediately before the start of interrupt sequence in the temporary register (note) within the cpu. (3) sets the interrupt enable flag (i flag), the debug flag (d flag), and the stack pointer select flag (u flag) to 0 (the u flag, however does not change if the int instruction, in software interrupt numbers 32 through 63, is executed) (4) saves the content of the temporary register (note) within the cpu in the stack area. (5) saves the content of the program counter (pc) in the stack area. (6) sets the interrupt priority level of the accepted instruction in the ipl. after the interrupt sequence is completed, the processor resumes executing instructions from the first address of the interrupt routine. note: this register cannot be utilized by the user. interrupt response time 'interrupt response time' is the period between the instant an interrupt occurs and the instant the first instruction within the interrupt routine has been executed. this time comprises the period from the occurrence of an interrupt to the completion of the instruction under execution at that moment (a) and the time required for executing the interrupt sequence (b). figure 1.11.4 shows the interrupt response time. instruction interrupt sequence instruction in interrupt routine time interrupt response time (a) (b) interrupt request acknowledged interrupt request generated (a) time from interrupt request is generated to when the instruction then under execution is completed. (b) time in which the instruction sequence is executed. figure 1.11.4. interrupt response time
interrupt 54 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r interrupt sources without priority levels 7 value set in the ipl _______ watchdog timer, nmi other not changed 0 variation of ipl when interrupt request is accepted if an interrupt request is accepted, the interrupt priority level of the accepted interrupt is set in the ipl. if an interrupt request, that does not have an interrupt priority level, is accepted, one of the values shown in table 1.11.6 is set in the ipl. table 1.11.6. relationship between interrupts without interrupt priority levels and ipl stack pointer (sp) value interrupt vector address 16-bit bus, without wait 8-bit bus, without wait even even odd (note 2) odd (note 2) even odd even odd 18 cycles (note 1) 19 cycles (note 1) 19 cycles (note 1) 20 cycles (note 1) 20 cycles (note 1) 20 cycles (note 1) 20 cycles (note 1) 20 cycles (note 1) table 1.11.5. time required for executing the interrupt sequence reset indeterminate 123456789 1011 12 13 14 15 16 17 18 the indeterminate segment is dependent on the queue buffer. if the queue buffer is ready to take an instruction, a read cycle occurs. indeterminate sp-2 contents sp-4 contents vec contents vec+2 contents interrupt information address 0000 indeterminate sp-2 sp-4 vec vec+2 pc bclk address bus data bus w r time (a) is dependent on the instruction under execution. thirty cycles is the maximum required for the divx instruction (without wait). time (b) is as shown in table 1.11.5. ________ note 1: add 2 cycles in the case of a dbc interrupt; add 1 cycle in the case either of an address match interrupt or of a single-step interrupt. note 2: locate an interrupt vector address in an even address, if possible. figure 1.11.5. time required for executing the interrupt sequence
interrupt 55 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r saving registers in the interrupt sequence, only the contents of the flag register (flg) and that of the program counter (pc) are saved in the stack area. first, the processor saves the four higher-order bits of the program counter, and 4 upper-order bits and 8 lower-order bits of the flg register, 16 bits in total, in the stack area, then saves 16 lower-order bits of the program counter. figure 1.11.6 shows the state of the stack as it was before the acceptance of the interrupt request, and the state the stack after the acceptance of the interrupt request. save other necessary registers at the beginning of the interrupt routine using software. using the pushm instruction alone can save all the registers except the stack pointer (sp). address content of previous stack stack area [sp] stack pointer value before interrupt occurs m m C 1 m C 2 m C 3 m C 4 stack status before interrupt request is acknowledged stack status after interrupt request is acknowledged content of previous stack m + 1 msb lsb m m C 1 m C 2 m C 3 m C 4 address flag register (flg l ) content of previous stack stack area flag register (flg h ) program counter (pc h ) [sp] new stack pointer value content of previous stack m + 1 msb lsb program counter (pc l ) program counter (pc m ) figure 1.11.6. state of stack before and after acceptance of interrupt request
interrupt 56 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.11.7. operation of saving registers (2) stack pointer (sp) contains odd number [sp] (odd) [sp] C 1 (even) [sp] C 2(odd) [sp] C 3 (even) [sp] C 4(odd) [sp] C 5 (even) address sequence in which order registers are saved (2) (1) finished saving registers in four operations. (3) (4) (1) stack pointer (sp) contains even number [sp] (even) [sp] C 1(odd) [sp] C 2 (even) [sp] C 3(odd) [sp] C 4 (even) [sp] C 5 (odd) note: [sp] denotes the initial value of the stack pointer (sp) when interrupt request is acknowledged. after registers are saved, the sp content is [sp] minus 4. address program counter (pc m ) stack area flag register (flg l ) program counter (pc l ) sequence in which order registers are saved (2) saved simultaneously, all 16 bits (1) saved simultaneously, all 16 bits finished saving registers in two operations. program counter (pc m ) stack area flag register (flg l ) program counter (pc l ) saved simultaneously, all 8 bits flag register (flg h ) program counter (pc h ) flag register (flg h ) program counter (pc h ) the operation of saving registers carried out in the interrupt sequence is dependent on whether the content of the stack pointer (note) , at the time of acceptance of an interrupt request, is even or odd. if the content of the stack pointer (note) is even, the content of the flag register (flg) and the content of the program counter (pc) are saved, 16 bits at a time. if odd, their contents are saved in two steps, 8 bits at a time. figure 1.11.7 shows the operation of the saving registers. note: when any int instruction in software numbers 32 to 63 has been executed, this is the stack pointer indicated by the u flag. otherwise, it is the interrupt stack pointer (isp).
interrupt 57 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r interrupt priority if there are two or more interrupt requests occurring at a point in time within a single sampling (checking whether interrupt requests are made), the interrupt assigned a higher priority is accepted. assign an arbitrary priority to maskable interrupts (peripheral i/o interrupts) using the interrupt priority level select bit. if the same interrupt priority level is assigned, however, the interrupt assigned a higher hardware priority is accepted. priorities of the special interrupts, such as reset (dealt with as an interrupt assigned the highest priority), watchdog timer interrupt, etc. are regulated by hardware. figure 1.11.8 shows the priorities of hardware interrupts. software interrupts are not affected by the interrupt priority. if an instruction is executed, control branches invariably to the interrupt routine. returning from an interrupt routine executing the reit instruction at the end of an interrupt routine returns the contents of the flag register (flg) as it was immediately before the start of interrupt sequence and the contents of the program counter (pc), both of which have been saved in the stack area. then control returns to the program that was being executed before the acceptance of the interrupt request, so that the suspended process resumes. return the other registers saved by software within the interrupt routine using the popm or similar instruc- tion before executing the reit instruction. interrupt resolution circuit when two or more interrupts are generated simultaneously, this circuit selects the interrupt with the highest priority level. figure 1.11.9 shows the circuit that judges the interrupt priority level. figure 1.11.8. hardware interrupts priorities _______ ________ reset > nmi > dbc > watchdog timer > peripheral i/o > single step > address match
interrupt 58 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.11.9. maskable interrupts priorities (peripheral i/o interrupts) timer b2 timer a1 timer b1 uart1 reception uart0 reception uart2 reception/ack a-d conversion bus collision detection timer a0 uart1 transmission uart0 transmission uart2 transmission/nack key input interrupt dma0 processor interrupt priority level (ipl) interrupt enable flag (i flag) int1 int2 int0 watchdog timer reset dbc nmi interrupt request accepted level 0 (initial value) priority level of each interrupt high low priority of peripheral i/o interrupts (if priority levels are same) address match interrupt request level judgment output to clock generating circuit (fig.1.10.3) timer a2
______ int interrupt 59 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r ______ int interrupt ________ ________ int0 to int2 are triggered by the edges of external inputs. the edge polarity is selected using the polarity select bit. as for external interrupt input, an interrupt can be generated both at the rising edge and at the falling edge by setting 1 in the inti interrupt polarity switching bit of the interrupt request cause select register (035f 16 ). to select both edges, set the polarity switching bit of the corresponding interrupt control register to falling edge (0). figure 1.11.10 shows the interrupt request cause select register. figure 1.11.10. interrupt request cause select register interrupt request cause select register bit name function bit symbol w r symbol address when reset ifsr 035f 16 00 16 ifsr0 b7 b6 b5 b4 b3 b2 b1 b0 aa aa a a aa aa a a int0 interrupt polarity switching bit 0 : one edge 1 : two edges 0 : one edge 1 : two edges 0 : one edge 1 : two edges must always be set to 0 int1 interrupt polarity switching bit int2 interrupt polarity switching bit ifsr1 ifsr2 reserved bit reserved bit reserved bit reserved bit reserved bit aa aa a a aa aa a a aa a aa a aa a aa aa a a aa a aa a must always be set to 0 must always be set to 0 must always be set to 0 must always be set to 0 00000
________ nmi interrupt 60 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r interrupt control circuit key input interrupt control register (address 004d 16 ) key input interrupt request p10 7 /ki 3 p10 6 /ki 2 p10 5 /ki 1 p10 4 /ki 0 port p10 4 -p10 7 pull-up select bit port p10 7 direction register pull-up transistor port p10 7 direction register port p10 6 direction register port p10 5 direction register port p10 4 direction register pull-up transistor pull-up transistor pull-up transistor figure 1.11.11. block diagram of key input interrupt ______ nmi interrupt ______ ______ ______ an nmi interrupt is generated when the input to the p8 5 /nmi pin changes from h to l. the nmi interrupt is a non-maskable external interrupt. the pin level can be checked in the port p8 5 register (bit 5 at address 03f0 16 ). this pin cannot be used as a normal port input. key input interrupt if the direction register of any of p10 4 to p10 7 is set for input and a falling edge is input to that port, a key input interrupt is generated. a key input interrupt can also be used as a key-on wakeup function for cancel- ling the wait mode or stop mode. however, if you intend to use the key input interrupt, do not use p10 4 to p10 7 as a-d input ports. figure 1.11.11 shows the block diagram of the key input interrupt. note that if an l level is input to any pin that has not been disabled for input, inputs to the other pins are not detected as an interrupt.
address match interrupt 61 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r address match interrupt an address match interrupt is generated when the address match interrupt address register contents match the program counter value. two address match interrupts can be set, each of which can be enabled and disabled by an address match interrupt enable bit. address match interrupts are not affected by the inter- rupt enable flag (i flag) and processor interrupt priority level (ipl). for an address match interrupt, the value of the program counter (pc) that is saved to the stack area varies depending on the instruction being executed. note that when using the external data bus in width of 8 bits, the address match interrupt cannot be used for external area. figure 1.11.12 shows the address match interrupt-related registers. bit name bit symbol symbol address when reset aier 0009 16 xxxxxx00 2 address match interrupt enable register function w r aaaaaaaaaaaaaa a aaaaaaaaaaaa a aaaaaaaaaaaaaa aaaaaaaaaaaaaa a aaaaaaaaaaaa a aaaaaaaaaaaaaa address match interrupt 0 enable bit 0 : interrupt disabled 1 : interrupt enabled aier0 address match interrupt 1 enable bit aier1 aaaaaaaaaaaaaa aaaaaaaaaaaaaa symbol address when reset rmad0 0012 16 to 0010 16 x00000 16 rmad1 0016 16 to 0014 16 x00000 16 nothing is assigned. in an attempt to write to these bits, write 0. the value, if read, turns out to be indeterminated. b7 b6 b5 b4 b3 b2 b1 b0 w r address setting register for address match interrupt function values that can be set address match interrupt register i (i = 0, 1) 00000 16 to fffff 16 nothing is assigned. in an attempt to write to these bits, write 0. the value, if read, turns out to be indeterminated. 0 : interrupt disabled 1 : interrupt enabled b0 b7 b0 b3 (b19) (b16) b7 b0 (b15) (b8) b7 (b23) aa a aa a aa aa a a figure 1.11.12. address match interrupt-related registers
precautions for interrupts 62 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r ______ figure 1.11.13. switching condition of int interrupt request set the interrupt priority level to level 0 (disable int i interrupt) set the polarity select bit nop x 2 set the interrupt priority level to level 1 to 7 (enable the accepting of inti interrupt request) clear the interrupt enable flag to 0 (disable interrupt) set the interrupt enable flag to 1 (enable interrupt) note: execute the setting above individually. don't execute two or more settings at once(by one instruction). clear the interrupt request bit to 0 precautions for interrupts (1) reading address 00000 16 ? when maskable interrupt is occurred, cpu reads the interrupt information (the interrupt number and interrupt request level) in the interrupt sequence. the interrupt request bit of the certain interrupt written in address 00000 16 will then be set to 0. even if the address 00000 16 is read out by software, 0 is set to the enabled highest priority interrupt source request bit. therefore interrupt can be canceled and unexpected interrupt can occur. do not read address 00000 16 by software. (2) setting the stack pointer ? the value of the stack pointer immediately after reset is initialized to 0000 16 . accepting an interrupt before setting a value in the stack pointer may become a factor of runaway. be sure to set a value in _______ the stack pointer before accepting an interrupt. when using the nmi interrupt, initialize the stack pointer at the beginning of a program. concerning the first instruction immediately after reset, generat- _______ ing any interrupts including the nmi interrupt is prohibited. _______ (3) the nmi interrupt _______ _______ ?the nmi interrupt can not be disabled. be sure to connect nmi pin to vcc via a pull-up resistor if unused. be sure to work on it. _______ ? the nmi pin also serves as p8 5 , which is exclusively input. reading the contents of the p8 register allows reading the pin value. use the reading of this pin only for establishing the pin level at the time _______ when the nmi interrupt is input. _______ ? do not attempt to go into stop mode with the input to the nmi pin being in the l state. with the input to _______ the nmi being in the l state, the cm10 is fixed to 0, so attempting to go into stop mode is turned down. _______ ? do not attempt to go into wait mode with the input to the nmi pin being in the l state. with the input to _______ the nmi pin being in the l state, the cpu stops but the oscillation does not stop, so no power is saved. in this instance, the cpu is returned to the normal state by a later interrupt. _______ ? signals input to the nmi pin require l level and h level of 2 clock +300ns or more, from the operation clock of the cpu. (4) external interrupt ________ ? either an l level or an h level of at least 250 ns width is necessary for the signal input to pins int 0 ________ through int 2 regardless of the cpu operation clock. ________ ________ ? when the polarity of the int 0 to int 2 pins is changed, the interrupt request bit is sometimes set to 1. after changing the polarity, set the interrupt request bit to 0. figure 1.11.13 shows the procedure for ______ changing the int interrupt generate factor.
precautions for interrupts 63 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r example 1: int_switch1: fclr i ; disable interrupts. and.b #00h, 0055h ; clear ta0ic int. priority level and int. request bit. nop ; four nop instructions are required when using hold function. nop fset i ; enable interrupts. example 2: int_switch2: fclr i ; disable interrupts. and.b #00h, 0055h ; clear ta0ic int. priority level and int. request bit. mov.w mem, r0 ; dummy read. fset i ; enable interrupts. example 3: int_switch3: pushc flg ; push flag register onto stack fclr i ; disable interrupts. and.b #00h, 0055h ; clear ta0ic int. priority level and int. request bit. popc flg ; enable interrupts. the reason why two nop instructions (four when using the hold function) or dummy read are inserted before fset i in examples 1 and 2 is to prevent the interrupt enable flag i from being set before the interrupt control register is rewritten due to effects of the instruction queue. (5) rewrite the interrupt control register ? to rewrite the interrupt control register, do so at a point that does not generate the interrupt request for that register. if there is possibility of the interrupt request occur, rewrite the interrupt control register after the interrupt is disabled. the program examples are described as follow: when changing an interrupt control register in a sate of interrupts being disabled, please read the following precautions on instructions used before changing the register. changing a non-interrupt request bit if an interrupt request for an interrupt control register is generated during an instruction to rewrite the register is being executed, there is a case that the interrupt request bit is not set and consequently the interrupt is ignored. this will depend on the instruction. if this creates problems, use the below instruc- tions to change the register. instructions : and, or, bclr, bset changing the interrupt request bit when attempting to clear the interrupt request bit of an interrupt control register, the interrupt request bit is not cleared sometimes. this will depend on the instruction. if this creates problems, use the below instructions to change the register. instructions : mov
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r watchdog timer 64 watchdog timer the watchdog timer has the function of detecting when the program is out of control. therefore, we recom- mend using the watchdog timer to improve reliability of a system. the watchdog timer is a 15-bit counter which down-counts the clock derived by dividing the bclk using the prescaler. a watchdog timer interrupt is generated when an underflow occurs in the watchdog timer. when x in is selected for the bclk , bit 7 of the watchdog timer control register (address 000f 16 ) selects the prescaler division ratio (by 16 or by 128). when x cin is selected as the bclk, the prescaler is set for division by 2 regardless of bit 7 of the watchdog timer control register (address 000f 16 ). thus the watchdog timer's period can be calculated as given below. the watchdog timer's period is, however, subject to an error due to the prescaler. bclk write to the watchdog timer start register (address 000e 16 ) reset watchdog timer interrupt request watchdog timer set to 7fff 16 1/128 1/16 cm07 = 0 wdc7 = 1 cm07 = 0 wdc7 = 0 cm07 = 1 hold 1/2 prescaler for example, suppose that bclk runs at 16 mhz and that 16 has been chosen for the dividing ratio of the prescaler, then the watchdog timer's period becomes approximately 32.8 ms. the watchdog timer is initialized by writing to the watchdog timer start register (address 000e 16 ) and when a watchdog timer interrupt request is generated. the prescaler is initialized only when the microcomputer is reset. after a reset is cancelled, the watchdog timer and prescaler are both stopped. the count is started by writing to the watchdog timer start register (address 000e 16 ). in stop mode, wait mode and hold state, the watchdog timer and prescaler are stopped. counting is resumed from the held value when the modes or state are released. figure 1.12.1 shows the block diagram of the watchdog timer. figure 1.12.2 shows the watchdog timer- related registers. with x in chosen for bclk watchdog timer period = prescaler dividing ratio (16 or 128) x watchdog timer count (32768) bclk figure 1.12.1. block diagram of watchdog timer with x cin chosen for bclk watchdog timer period = prescaler dividing ratio (2) x watchdog timer count (32768) bclk
watchdog timer 65 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r watchdog timer control register symbol address when reset wdc 000f 16 000xxxxx 2 function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 high-order bit of watchdog timer wdc7 bit name prescaler select bit 0 : divided by 16 1 : divided by 128 watchdog timer start register symbol address when reset wdts 000e 16 indeterminate w r b7 b0 function the watchdog timer is initialized and starts counting after a write instruction to this register. the watchdog timer value is always initialized to 7fff 16 regardless of whatever value is written. reserved bit reserved bit must always be set to 0 must always be set to 0 0 0 aa aa a aa a aa a a figure 1.12.2. watchdog timer control and start registers
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r dmac 66 dmac this microcomputer has one dmac (direct memory access controller) channel that allow data to be sent to memory without using the cpu. dmac shares the same data bus with the cpu. the dmac is given a higher right of using the bus than the cpu, which leads to working the cycle stealing method. on this account, the operation from the occurrence of dma transfer request signal to the completion of 1-word (16- bit) or 1-byte (8-bit) data transfer can be performed at high speed. figure 1.13.1 shows the block diagram of the dmac. table 1.13.1 shows the dmac specifications. figures 1.13.2 to 1.13.4 show the registers used by the dmac. figure 1.13.1. block diagram of dmac aa aa aa aa aa aa data bus low-order bits dma latch high-order bits dma latch low-order bits data bus high-order bits aa aa aa aa aa aa aa aaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaa aaaaaaa address bus a a a a a a a a dma0 transfer counter reload register tcr0 (16) dma0 transfer counter tcr0 (16) a (addresses 0029 16 , 0028 16 ) (addresses 0026 16 to 0024 16 ) note: pointer is incremented by a dma request. a a a aa aa aa aa aa dma0 source pointer sar0(20) dma0 destination pointer dar0 (20) dma0 forward address pointer (20) (note) aa (addresses 0022 16 to 0020 16 ) a a a a a a aa aa a a a a either a write signal to the software dma request bit or an interrupt request signal is used as a dma transfer request signal. but the dma transfer is affected neither by the interrupt enable flag (i flag) nor by the interrupt priority level. the dma transfer doesn't affect any interrupts either. if the dmac is active (the dma enable bit is set to 1), data transfer starts every time a dma transfer request signal occurs. if the cycle of the occurrences of dma transfer request signals is higher than the dma transfer cycle, there can be instances in which the number of transfer requests doesn't agree with the number of transfers. for details, see the description of the dma request bit.
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r dmac 67 item specification no. of channels 2 (cycle steal method) transfer memory space ? from any address in the 1m bytes space to a fixed address ? from a fixed address to any address in the 1m bytes space ? from a fixed address to a fixed address (note that dma-related registers [0020 16 to 003f 16 ] cannot be accessed) maximum no. of bytes transferred 128k bytes (with 16-bit transfers) or 64k bytes (with 8-bit transfers) dma request factors (note) ________ falling edge of int0 or both edge timer a0 to timer a2 interrupt requests timer b1 and timer b2 interrupt requests uart0 transfer and reception interrupt requests uart1 transfer and reception interrupt requests uart2 transfer and reception interrupt requests a-d conversion interrupt requests software triggers transfer unit 8 bits or 16 bits transfer address direction forward/fixed (forward direction cannot be specified for both source and destination simultaneously) transfer mode ? single transfer mode after the transfer counter underflows, the dma enable bit turns to 0, and the dmac turns inactive ? repeat transfer mode after the transfer counter underflows, the value of the transfer counter reload register is reloaded to the transfer counter. the dmac remains active unless a 0 is written to the dma enable bit. dma interrupt request generation timing when an underflow occurs in the transfer counter active when the dma enable bit is set to 1. when the dmac is active, data transfer starts every time a dma transfer request signal occurs. inactive ? when the dma enable bit is set to 0. at the time of starting data transfer immediately after turning the dmac active, the value of one of source pointer and destination pointer - the one specified for the forward direction - is reloaded to the forward direction address pointer, and the value of the transfer counter reload register is reloaded to the transfer counter. writing to register registers specified for forward direction transfer are always write enabled. registers specified for fixed address transfer are write-enabled when the dma enable bit is 0. reading the register can be read at any time. however, when the dma enable bit is 1, reading the register set up as the forward register is the same as reading the value of the forward address pointer. table 1.13.1. dmac specifications note: dma transfer is not effective to any interrupt. dma transfer is affected neither by the interrupt enable flag (i flag) nor by the interrupt priority level. reload timing for forward address pointer and transfer counter
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r dmac 68 dma0 request cause select register symbol address when reset dm0sl 03b8 16 00 16 function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 dma request cause select bit dsel0 rw dsel1 dsel2 dsel3 software dma request bit if software trigger is selected, a dma request is generated by setting this bit to 1 (when read, the value of this bit is always 0) dsr b6 b5 b4 b3 b2 b1 b0 aa a aa a aa a aa aa a a aa aa a a bit name aa a 0 0 0 0 0 0 0 : falling edge of int0 pin 0 0 0 0 0 0 1 : software trigger 0 0 0 0 0 1 0 : timer a0 0 0 0 0 0 1 1 : timer a1 0 0 0 0 1 0 0 : timer a2 0 0 0 0 1 0 1 : must not be set 0 0 0 0 1 1 0 : must not be set 0 0 0 0 1 1 1 : must not be set 0 0 0 1 0 0 0 : timer b1 0 0 0 1 0 0 1 : timer b2 0 0 0 1 0 1 0 : uart0 transmit 0 0 0 1 0 1 1 : uart0 receive 0 0 0 1 1 0 0 : uart2 transmit 0 0 0 1 1 0 1 : uart2 receive 0 0 0 1 1 1 0 : a-d conversion 0 0 0 1 1 1 1 : uart1 transmit 1 0 0 0 1 1 0 : two edges of int0 pin must not be set except the above. aa a aa a dsel4 dsel5 dms (dms) figure 1.13.2. dmac register (1)
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r dmac 69 dma0 control register symbol address when reset dm0con 002c 16 00000x00 2 bit name function bit symbol transfer unit bit select bit b7 b6 b5 b4 b3 b2 b1 b0 0 : 16 bits 1 : 8 bits dmbit rw dmasl dmas dmae repeat transfer mode select bit 0 : single transfer 1 : repeat transfer dma request bit (note 1) 0 : dma not requested 1 : dma requested 0 : disabled 1 : enabled 0 : fixed 1 : forward dma enable bit source address direction select bit (note 3) destination address direction select bit (note 3) 0 : fixed 1 : forward dsd dad nothing is assigned. in an attempt to write to these bits, write 0. the value, if read, turns out to be 0. note 1: dma request can be cleared by resetting the bit. note 2: this bit can only be set to 0. note 3: source address direction select bit and destination address direction select bit cannot be set to 1 simultaneously. (note 2) a a a a a a a a a a a a a a figure 1.13.3. dmac register (2)
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r dmac 70 b7 b0 b7 b0 (b8) (b15) function rw ? transfer counter set a value one less than the transfer count symbol address when reset tcr0 0029 16 , 0028 16 indeterminate dma0 transfer counter transfer count specification 0000 16 to ffff 16 b7 (b23) b3 b0 b7 b0 b7 b0 (b8) (b16)(b15) (b19) function rw ? source pointer stores the source address symbol address when reset sar0 0022 16 to 0020 16 indeterminat e dma0 source pointer transfer address specification 00000 16 to fffff 16 nothing is assigned. in an attempt to write to these bits, write 0. the value, if read, turns out to be 0. symbol address when reset dar0 0026 16 to 0024 16 indeterminat e b3 b0 b7 b0 b7 b0 (b8) (b15) (b16) (b19) function rw ? destination pointer stores the destination address dma0 destination pointer transfer address specification 00000 16 to fffff 16 b7 (b23) nothing is assigned. in an attempt to write to these bits, write 0. the value, if read, turns out to be 0. a a a a a a a a figure 1.13.4. dmac register (3)
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r dmac 71 (1) transfer cycle the transfer cycle consists of the bus cycle in which data is read from memory or from the sfr area (source read) and the bus cycle in which the data is written to memory or to the sfr area (destination write). the number of read and write bus cycles depends on the source and destination addresses. in memory expansion mode and microprocessor mode, the number of read and write bus cycles also de- pends on the level of the byte pin. also, the bus cycle itself is longer when software waits are inserted. (a) effect of source and destination addresses when 16-bit data is transferred on a 16-bit data bus, and the source and destination both start at odd addresses, there are one more source read cycle and destination write cycle than when the source and destination both start at even addresses. (b) effect of byte pin level when transferring 16-bit data over an 8-bit data bus (byte pin = h) in memory expansion mode and microprocessor mode, the 16 bits of data are sent in two 8-bit blocks. therefore, two bus cycles are required for reading the data and two are required for writing the data. also, in contrast to when the cpu accesses internal memory, when the dmac accesses internal memory (internal rom, internal ram, and sfr), these areas are accessed using the data size selected by the byte pin. (c) effect of software wait when the sfr area or a memory area with a software wait is accessed, the number of cycles is increased for the wait by 1 bus cycle. the length of the cycle is determined by bclk. figure 1.13.5 shows the example of the transfer cycles for a source read. for convenience, the destina- tion write cycle is shown as one cycle and the source read cycles for the different conditions are shown. in reality, the destination write cycle is subject to the same conditions as the source read cycle, with the transfer cycle changing accordingly. when calculating the transfer cycle, remember to apply the respec- tive conditions to both the destination write cycle and the source read cycle. for example (2) in figure 1.13.5, if data is being transferred in 16-bit units on an 8-bit bus, two bus cycles are required for both the source read cycle and the destination write cycle.
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r dmac 72 bclk address bus rd signal wr signal data bus cpu use cpu use cpu use cpu use source source destination destination dummy cycle dummy cycle (1) 8-bit transfers 16-bit transfers and the source address is even. bclk address bus rd signal wr signal data bus cpu use cpu use cpu use cpu use source source destination destination dummy cycle dummy cycle (3) one wait is inserted into the source read under the conditions in (1) bclk address bus rd signal wr signal data bus cpu use cpu use cpu use cpu use source source destination destination dummy cycle dummy cycle source + 1 source + 1 (2) 16-bit transfers and the source address is odd transferring 16-bit data on an 8-bit data bus (in this case, there are also two destination cycles). bclk address bus rd signal wr signal data bus cpu use cpu use cpu use cpu use source source destination destination dummy cycle dummy cycle source + 1 source + 1 (4) one wait is inserted into the source read under the conditions in (2) (when 16-bit data is transferred on an 8-bit data bus, there are two destination cycles). note: the same timing changes occur with the respective conditions at the destination as at the source. figure 1.13.5. example of the transfer cycles for a source read
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r dmac 73 single-chip mode memory expansion mode transfer unit bus width access address microprocessor mode no. of read no. of write no. of read no. of write cycles cycles cycles cycles 16-bit even 1111 8-bit transfers (byte= l) odd 1111 (dmbit= 1) 8-bit even 1 1 (byte = h) odd 1 1 16-bit even 1111 16-bit transfers (byte = l) odd 2222 (dmbit= 0) 8-bit even 2 2 (byte = h) odd 2 2 table 1.13.2. no. of dmac transfer cycles internal memory external memory internal rom/ram internal rom/ram sfr area separate bus separate bus multiplex no wait with wait no wait with wait bus 122123 coefficient j, k (2) dmac transfer cycles any combination of even or odd transfer read and write addresses is possible. table 1.13.2 shows the number of dmac transfer cycles. the number of dmac transfer cycles can be calculated as follows: no. of transfer cycles per transfer unit = no. of read cycles x j + no. of write cycles x k
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r dmac 74 dma enable bit setting the dma enable bit to 1 makes the dmac active. the dmac carries out the following operations at the time data transfer starts immediately after dmac is turned active. (1) reloads the value of one of the source pointer and the destination pointer - the one specified for the forward direction - to the forward direction address pointer. (2) reloads the value of the transfer counter reload register to the transfer counter. thus overwriting 1 to the dma enable bit with the dmac being active carries out the operations given above, so the dmac operates again from the initial state at the instant 1 is overwritten to the dma enable bit. dma request bit the dmac can generate a dma transfer request signal triggered by a factor chosen in advance out of dma request factors. dma request factors include the following. * factors effected by using the interrupt request signals from the built-in peripheral functions and software dma factors (internal factors) effected by a program. * external factors effected by utilizing the input from external interrupt signals. for the selection of dma request factors, see the descriptions of the dma0 factor selection register. the dma request bit turns to 1 if the dma transfer request signal occurs regardless of the dmac's state (regardless of whether the dma enable bit is set to 1 or 0). it turns to 0 immediately before data transfer starts. in addition, it can be set to 0 by use of a program, but cannot be set to 1. there can be instances in which a change in dma request factor selection bit causes the dma request bit to turn to 1. so be sure to set the dma request bit to 0 after the dma request factor selection bit is changed. the dma request bit turns to 1 if a dma transfer request signal occurs, and turns to 0 immediately before data transfer starts. if the dmac is active, data transfer starts immediately, so the value of the dma request bit, if read by use of a program, turns out to be 0 in most cases. to examine whether the dmac is active, read the dma enable bit. here follows the timing of changes in the dma request bit. (1) internal factors except the dma request factors triggered by software, the timing for the dma request bit to turn to 1 due to an internal factor is the same as the timing for the interrupt request bit of the interrupt control register to turn to 1 due to several factors. turning the dma request bit to 0 due to an internal factor is timed to be effected immediately before the transfer starts. (2) external factors ________ an external factor is a factor caused to occur by the leading edge of input from the int0 pin. ________ selecting the int0 pins as external factors using the dma request factor selection bit causes input from these pins to become the dma transfer request signals. the timing for the dma request bit to turn to 1 when an external factor is selected synchronizes with the signal's edge applicable to the function specified by the dma request factor selection bit (synchronizes ________ with the trailing edge of the input signal to int0 pin, for example). with an external factor selected, the dma request bit is timed to turn to 0 immediately before data transfer starts similarly to the state in which an internal factor is selected.
timer 75 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r timer there are five 16-bit timers. these timers can be classified by function into timers a (three) and timers b (two). all these timers function independently. figures 1.14.1 and 1.14.2 show the block diagram of timers. ? timer mode ? one-shot timer mode ? pwm mode ? timer mode ? one-shot timer mode ? pwm mode ? timer mode ? one-shot timer mode ? pwm mode ? event counter mode ? event counter mode ? event counter mode ta0 in ta1 in ta2 in timer a0 timer a1 timer a2 f 1 f 8 f 32 f c32 timer a0 interrupt timer a1 interrupt timer a2 interrupt noise filter noise filter noise filter 1/32 f c32 1/8 1/4 f 1 f 8 f 32 x in x cin clock prescaler reset flag (bit 7 at address 0381 16 ) set to 1 reset clock prescaler timer b2 overflow note : the ta0 in pin (p7 1 ) is shared with rxd 2 , so be careful. figure 1.14.1. timer a block diagram
timer 76 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.14.2. timer b block diagram ? event counter mode ? event counter mode ? timer mode ? pulse width measuring mode ? timer mode ? pulse width measuring mode tb1 in tb2 in timer b1 timer b2 f 1 f 8 f 32 f c32 noise filter noise filter 1/32 f c32 1/8 1/4 f 1 f 8 f 32 x in x cin clock prescaler reset flag (bit 7 at address 0381 16 ) set to 1 reset clock prescaler timer a timer b1 interrupt timer b2 interrupt
timer a 77 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r timer a figure 1.14.3 shows the block diagram of timer a. figures 1.14.4 to 1.14.6 show the timer a-related registers. except in event counter mode, timers a0 through a2 all have the same function. use the timer ai mode register (i = 0 to 2) bits 0 and 1 to choose the desired mode. timer a has the four operation modes listed as follows: ? timer mode: the timer counts an internal count source. ? event counter mode: the timer counts pulses from an external source or a timer overflow. ? one-shot timer mode: the timer stops counting when the count reaches 0000 16 . ? pulse width modulation (pwm) mode: the timer outputs pulses of a given width. figure 1.14.4. timer a-related registers (1) count start flag (address 0380 16 ) up count/down count tai addresses taj tak timer a0 0387 16 0386 16 must not be set timer a1 timer a1 0389 16 0388 16 timer a0 timer a2 timer a2 038b 16 038a 16 timer a1 must not be set always down count except in event counter mode reload register (16) counter (16) low-order 8 bits aaa aaa high-order 8 bits clock source selection timer (gate function) timer one shot pwm f 1 f 8 f 32 tai in (i = 0 to 2) tb2 overflow event counter f c32 clock selection taj overflow (j = i e 1. note, however, must not be set when i = 0) pulse output toggle flip-flop tai out (i = 0 to 2) data bus low-order bits data bus high-order bits aa aa aa up/down flag down count (address 0384 16 ) tak overflow (k = i + 1. note, however, must not be set when i = 2) polarity selection clock selection to external trigger circuit timer ai mode register symbol address when reset taimr(i=0 to 2) 0396 16 to 0398 16 00 16 bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 0 0 : timer mode 0 1 : event counter mode 1 0 : one-shot timer mode 1 1 : pulse width modulation (pwm) mode b1 b0 tck1 mr3 mr2 mr1 tmod1 mr0 tmod0 tck0 function varies with each operation mode count source select bit (function varies with each operation mode) operation mode select bit a aa a aa a aa a aa a aa a a aa aa a aa a a aa aa figure 1.14.3. block diagram of timer a
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r timer a 78 figure 1.14.5. timer a-related registers (2) symbol address when reset ta0 0387 16 ,0386 16 indeterminate ta1 0389 16 ,0388 16 indeterminate ta2 038b 16 ,038a 16 indeterminate b7 b0 b7 b0 (b15) (b8) timer ai register (note 1) w r ? timer mode 0000 16 to ffff 16 counts an internal count source function values that can be set ? event counter mode 0000 16 to ffff 16 counts pulses from an external source or timer overflow ? one-shot timer mode 0000 16 to ffff 16 counts a one shot width (note 2,4) ? pulse width modulation mode (16-bit pwm) functions as a 16-bit pulse width modulator ? pulse width modulation mode (8-bit pwm) timer low-order address functions as an 8-bit prescaler and high-order address functions as an 8-bit pulse width modulator 0000 16 to fffe 16 (note 3,4) a a a a a a a a note 1: read and write data in 16-bit units. note 2: when the timer ai register is set to 0000 16 , the counter does not operate and the timer ai interrupt request is not generated. when the pulse is set to output, the pulse does not output from the tai out pin. note 3: when the timer ai register is set to 0000 16 , the pulse width modulator does not operate and the output level of the tai out pin remains l level, therefore the timer ai interrupt request is not generated. this also occurs in the 8-bit pulse width modulator mode when the significant 8 high-order bits in the timer ai register are set to 00 16 . note 4: use mov instruction to write to this register. 00 16 to fe 16 (high-order address) 00 16 to ff 16 (low-order address) (note 3,4) symbol address when reset tabsr 0380 16 00 16 count start flag bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa timer b2 count start flag timer b1 count start flag timer a2 count start flag timer a1 count start flag timer a0 count start flag 0 : stops counting 1 : starts counting tb2s tb1s ta2s ta1s ta0s a a a a a a a a a a a a a a 0 : stops counting 1 : starts counting reserved bit must always be set to 0 000 timer a2 up/down flag timer a1 up/down flag timer a0 up/down flag timer a2 two-phase pulse signal processing select bit symbol address when reset udf 0384 16 00 16 ta2p up/down flag (note 1) bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 ta2ud ta1ud ta0ud 0 : down count 1 : up count this specification becomes valid when the up/down flag content is selected for up/down switching cause 0 : two-phase pulse signal processing disabled 1 : two-phase pulse signal processing enabled (note 2) when not using the two-phase pulse signal processing function, set the select bit to 0 a a a a a a a a a a note 1: use mov instruction to write to this register. note 2: set the tai in and tai out p ins corres p ondent p ort direction re g isters to 0. 00 00 reserved bit must always be set to 0 reserved bit must always be set to 0
timer a 79 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r symbol address when reset cpsrf 0381 16 0xxxxxxx 2 clock prescaler reset flag bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa clock prescaler reset flag 0 : no effect 1 : prescaler is reset (when read, the value is 0) cpsr w r nothing is assigned. in an attempt to write to these bits, write 0. the value, if read, turns out to be indeterminate. a aa ta1os ta2os ta0os one-shot start flag symbol address when reset onsf 0382 16 00x00000 2 timer a0 one-shot start flag timer a1 one-shot start flag timer a2 one-shot start flag bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 nothing is assigned. in an attempt to write to this bit, write 0. the value, if read, turns out to be indeterminate. ta0tgl ta0tgh 0 0 : input on ta0 in is selected (note) 0 1 : tb2 overflow is selected 1 0 : must not be set 1 1 : ta1 overflow is selected timer a0 event/trigger select bit b7 b6 note: set the corresponding port direction register to 0. w r 1 : timer start when read, the value is 0 a a a a a a a a a a a a a a reserved bit must always be set to 0 00 ta1tgl symbol address when reset trgsr 0383 16 00 16 timer a1 event/trigger select bit 0 0 : input on ta1 in is selected (note) 0 1 : tb2 overflow is selected 1 0 : ta0 overflow is selected 1 1 : ta2 overflow is selected trigger select register bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 0 0 : input on ta2 in is selected (note) 0 1 : tb2 overflow is selected 1 0 : ta1 overflow is selected 1 1 : must not be set timer a2 event/trigger select bit w r ta1tgh ta2tgl ta2tgh b1 b0 b3 b2 note: set the corresponding port direction register to 0. a aa a aa a aa a a aa aa a a aa aa a a aa aa reserved bit must always be set to 0 000 0 figure 1.14.6. timer a-related registers (3)
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r timer a 80 item specification count source f 1 , f 8 , f 32 , f c32 count operation ? down count ? when the timer underflows, it reloads the reload register contents before continuing counting divide ratio 1/(n+1) n : set value count start condition count start flag is set (= 1) count stop condition count start flag is reset (= 0) interrupt request generation timing when the timer underflows tai in pin function programmable i/o port or gate input tai out pin function programmable i/o port or pulse output read from timer count value can be read out by reading timer ai register write to timer ? when counting stopped when a value is written to timer ai register, it is written to both reload register and counter ? when counting in progress when a value is written to timer ai register, it is written to only reload register (transferred to counter at next reload time) select function ? gate function counting can be started and stopped by the tai in pins input signal ? pulse output function each time the timer underflows, the tai out pins polarity is reversed (1) timer mode in this mode, the timer counts an internally generated count source. (see table 1.14.1.) figure 1.14.7 shows the timer ai mode register in timer mode. table 1.14.1. specifications of timer mode note 1: the settings of the corresponding port register and port direction register are invalid. note 2: the bit can be 0 or 1. note 3: set the corresponding port direction register to 0. timer ai mode register symbol address when reset taimr(i=0 to 2) 0396 16 to 0398 16 00 16 bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 operation mode select bit 0 0 : timer mode b1 b0 tmod1 tmod0 mr0 pulse output function select bit 0 : pulse is not output (ta iout pin is a normal port pin) 1 : pulse is output (note 1) (ta iout pin is a pulse output pin) gate function select bit 0 x (note 2) : gate function not available (tai in pin is a normal port pin) 1 0 : timer counts only when ta iin pin is held l (note 3) 1 1 : timer counts only when ta iin pin is held h (note 3) b4 b3 mr2 mr1 mr3 0 (must always be 0 in timer mode) 0 0 : f 1 0 1 : f 8 1 0 : f 32 1 1 : f c32 b7 b6 tck1 tck0 count source select bit 00 0 a a a a a a a a a a a a a a a a a a a a figure 1.14.7. timer ai mode register in timer mode
timer a 81 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r item specification count source ? external signals input to tai in pin (effective edge can be selected by software) ? tb2 overflow, taj overflow count operation ? up count or down count can be selected by external signal or software ? when the timer overflows or underflows, it reloads the reload register con tents before continuing counting (note) divide ratio 1/ (ffff 16 - n + 1) for up count 1/ (n + 1) for down count n : set value count start condition count start flag is set (= 1) count stop condition count start flag is reset (= 0) interrupt request generation timing the timer overflows or underflows tai in pin function programmable i/o port or count source input tai out pin function programmable i/o port, pulse output, or up/down count select input read from timer count value can be read out by reading timer ai register write to timer ? when counting stopped when a value is written to timer ai register, it is written to both reload register and counter ? when counting in progress when a value is written to timer ai register, it is written to only reload register (transferred to counter at next reload time) select function ? free-run count function even when the timer overflows or underflows, the reload register content is not reloaded to it ? pulse output function each time the timer overflows or underflows, the tai out pins polarity is reversed note: this does not apply when the free-run function is selected. (2) event counter mode in this mode, the timer counts an external signal or an internal timers overflow. timers a0 and a1 can count a single-phase external signal. timer a2 can count a single-phase and a two-phase external signal. table 1.14.2 lists timer specifications when counting a single-phase external signal. figure 1.14.8 shows the timer ai mode register in event counter mode. table 1.14.3 lists timer specifications when counting a two-phase external signal. figure 1.14.9 shows the timer ai mode register in event counter mode. table 1.14.2. timer specifications in event counter mode (when not processing two-phase pulse signal) figure 1.14.8. timer ai mode register in event counter mode note 1: in event counter mode, the count source is selected by the event / trigger select bit (addresses 0382 16 and 0383 16 ). note 2: the settings of the corresponding port register and port direction register are invalid. note 3: valid only when counting an external signal. note 4: when an l signal is input to the tai out pin, the downcount is activated. when h, the upcount is activated. set the corresponding port direction register to 0. symbol address when reset taimr(i = 0 to 2) 0396 16 to 0398 16 00 16 w r b7 b6 b5 b4 b3 b2 b1 b0 operation mode select bit 0 1 : event counter mode (note 1) b1 b0 tmod0 mr0 pulse output function select bit 0 : pulse is not output (ta iout pin is a normal port pin) 1 : pulse is output (note 2) (ta iout pin is a pulse output pin) count polarity select bit (note 3) mr2 mr1 mr3 0 (must always be 0 in event counter mode) tck0 count operation type select bit 01 0 0 : counts external signal's falling edge 1 : counts external signal's rising edge up/down switching cause select bit 0 : up/down flag's content 1 : ta iout pin's input signal (note 4) 0 : reload type 1 : free-run type bit symbol bit name function rw tck1 invalid when not using two-phase pulse signal processing can be 0 or 1 tmod1 a a a a a a a a a a a a a a a a a a a a a a a a timer ai mode register (when not using two-phase pulse signal processing)
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r timer a 82 item specification count source ? two-phase pulse signals input to ta2 in or ta2 out pin count operation ? up count or down count can be selected by two-phase pulse signal ? when the timer overflows or underflows, the reload register content is reloaded and the timer starts over again (note) divide ratio 1/ (ffff 16 - n + 1) for up count 1/ (n + 1) for down count n : set value count start condition count start flag is set (= 1) count stop condition count start flag is reset (= 0) interrupt request generation timing timer overflows or underflows ta2 in pin function two-phase pulse input (set the ta2 in pin correspondent port direction register to 0.) ta2 out pin function two-phase pulse input (set the ta2 out pin correspondent port direction register to 0.) read from timer count value can be read out by reading timer a2 register write to timer ? when counting stopped when a value is written to timer a2 register, it is written to both reload register and counter ? when counting in progress when a value is written to timer a2 register, it is written to only reload register. (transferred to counter at next reload time.) select function ? normal processing operation the timer counts up rising edges or counts down falling edges on the ta2 in pin when input signal on the ta2 out pin is h. note: this does not apply when the free-run function is selected. table 1.14.3. timer specifications in event counter mode (when processing two-phase pulse signal with timer a2) ta2 out up count up count up count down count down count down count ta2 in
timer a 83 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r note : when performing two-phase pulse signal processing, make sure the two-phase pulse signal processing operation select bit (address 0384 16 ) is set to 1. also, always be sure to set the event/trigger select bit (address 0383 16 ) to 00. timer ai mode register (when using two-phase pulse signal processing) (note) symbol address when reset ta2mr 0398 16 00 16 b6 b5 b4 b3 b2 b1 b0 operation mode select bit 0 1 : event counter mode b1 b0 tmod1 tmod0 mr0 0 (must always be 0 when using two-phase pulse signal processing) 0 (must always be 0 when using two-phase pulse signal processing) mr2 mr1 mr3 0 (must always be 0 when using two-phase pulse signal processing) tck0 01 0 1 (must always be 1 when using two-phase pulse signal processing) bit name function w r count operation type select bit 0 : reload type 1 : free-run type 0 0 1 aa aa a a aa a aa a aa a aa a aa a aa a aa aa a a tck1 0 (must always be 0 when using two-phase pulse signal processing) 0 figure 1.14.9. timer ai mode register in event counter mode
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r timer a 84 item specification count source f 1 , f 8 , f 32 , f c32 count operation ? the timer counts down ? when the count reaches 0000 16 , the timer stops counting after reloading a new count ? if a trigger occurs when counting, the timer reloads a new count and restarts counting divide ratio 1/n n : set value count start condition ? an external trigger is input ? the timer overflows ? the one-shot start flag is set (= 1) count stop condition ? a new count is reloaded after the count has reached 0000 16 ? the count start flag is reset (= 0) interrupt request generation timing the count reaches 0000 16 tai in pin function programmable i/o port or trigger input tai out pin function programmable i/o port or pulse output read from timer when timer ai register is read, it indicates an indeterminate value write to timer ? when counting stopped when a value is written to timer ai register, it is written to both reload register and counter ? when counting in progress when a value is written to timer ai register, it is written to only reload register (transferred to counter at next reload time) table 1.14.4. timer specifications in one-shot timer mode figure 1.14.10. timer ai mode register in one-shot timer mode (3) one-shot timer mode in this mode, the timer operates only once. (see table 1.14.4.) when a trigger occurs, the timer starts up and continues operating for a given period. figure 1.14.10 shows the timer ai mode register in one-shot timer mode. bit name timer ai mode register symbol address when reset taimr(i = 0 to 2) 0396 16 to 0398 16 00 16 function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 operation mode select bit 1 0 : one-shot timer mode b1 b0 tmod1 tmod0 mr0 pulse output function select bit 0 : pulse is not output (ta iout pin is a normal port pin) 1 : pulse is output (note 1) (tai out pin is a pulse output pin) mr2 mr1 mr3 0 (must always be 0 in one-shot timer mode) 0 0 : f 1 0 1 : f 8 1 0 : f 32 1 1 : f c32 b7 b6 tck1 tck0 count source select bit 10 0 0 : one-shot start flag is valid 1 : selected by event/trigger select bits trigger select bit external trigger select bit (note 2) 0 : falling edge of tai in pin's input signal (note 3) 1 : rising edge of tai in pin's input signal (note 3) note 1: the settings of the corresponding port register and port direction register are invalid. note 2: valid only when the tai in pin is selected by the event/trigger select bit (addresses 0382 16 and 0383 16 ). if timer overflow is selected, this bit can be 1 or 0. note 3: set the corres p ondin g p ort direction re g ister to 0. w r aa a aa aa a a aa a aa aa a a aa a aa a aa a aa a
timer a 85 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r (4) pulse width modulation (pwm) mode in this mode, the timer outputs pulses of a given width in succession. (see table 1.14.5.) in this mode, the counter functions as either a 16-bit pulse width modulator or an 8-bit pulse width modulator. figure 1.14.11 shows the timer ai mode register in pulse width modulation mode. figure 1.14.12 shows the example of how a 16-bit pulse width modulator operates. figure 1.14.13 shows the example of how an 8- bit pulse width modulator operates. figure 1.14.11. timer ai mode register in pulse width modulation mode table 1.14.5. timer specifications in pulse width modulation mode bit name timer ai mode register symbol address when reset taimr(i=0 to 2) 0396 16 to 0398 16 00 16 function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 operation mode select bit 1 1 : pwm mode b1 b0 tmod1 tmod0 mr0 mr2 mr1 mr3 0 0 : f 1 0 1 : f 8 1 0 : f 32 1 1 : f c32 b7 b6 tck1 tck0 count source select bit w r 11 1 1 (must always be 1 in pwm mode) 16/8-bit pwm mode select bit 0: functions as a 16-bit pulse width modulator 1: functions as an 8-bit pulse width modulator trigger select bit external trigger select bit (note 1) 0: falling edge of tai in pin's input signal (note 2) 1: rising edge of tai in pin's input signal (note 2) 0: count start flag is valid 1: selected by event/trigger select bits note 1: valid only when the ta iin pin is selected by the event/trigger select bit (addresses 0382 16 and 0383 16 ). if timer overflow is selected, this bit can be 1 or 0. note 2: set the corresponding port direction register to 0. a a aa aa a aa a aa a aa a aa a a aa aa a aa a aa item specification count source f 1 , f 8 , f 32 , f c32 count operation t he timer counts down (operating as an 8-bit or a 16-bit pulse width modulator) the timer reloads a new count at a rising edge of pwm pulse and continues counting the timer is not affected by a trigger that occurs when counting 16-bit pwm high level width n / fi n : set value cycle time (2 16 -1) / fi fixed 8-bit pwm high level width n (m+1) / fi n : values set to timer ai register?s high-order address cycle time (2 8 - 1) (m+1) / fi m : values set to timer ai register?s low-order address count start condition external trigger is input the timer overflows the count start flag is set (= 1) count stop condition the count start flag is reset (= 0) interrupt request generation timing pwm pulse goes l tai in pin function programmable i/o port or trigger input tai out pin function pulse output read from timer when timer ai register is read, it indicates an indeterminate value write to timer when counting stopped when a value is written to timer ai register, it is written to both reload register and counter when counting in progress when a value is written to timer ai register, it is written to only reload register (transferred to counter at next reload time)
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r timer a 86 1 / f i x (2 C 1) 16 count source ta iin pin input signal pwm pulse output from ta iout pin condition : reload register = 0003 16 , when external trigger (rising edge of ta iin pin input signal) is selected trigger is not generated by this signal h h l l timer ai interrupt request bit 1 0 cleared to 0 when interrupt request is accepted, or cleared by software f i : frequency of count source (f 1 , f 8 , f 32 , f c32 ) note: n = 0000 16 to fffe 16 . 1 / f i x n count source (note1) ta iin pin input signal underflow signal of 8-bit prescaler (note2) pwm pulse output from ta iout pin h h h l l l 1 0 timer ai interrupt request bit cleared to 0 when interrupt request is accepted, or cleaerd by software f i : frequency of count source (f 1 , f 8 , f 32 , f c32 ) note 1: the 8-bit prescaler counts the count source. note 2: the 8-bit pulse width modulator counts the 8-bit prescaler's underflow signal. note 3: m = 00 16 to ff 16 ; n = 00 16 to fe 16 . aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa condition : reload register high-order 8 bits = 02 16 reload register low-order 8 bits = 02 16 external trigger (falling edge of ta iin pin input signal) is selected 1 / f i x (m + 1) x (2 e 1) 8 1 / f i x (m + 1) x n 1 / f i x (m + 1) figure 1.14.12. example of how a 16-bit pulse width modulator operates figure 1.14.13. example of how an 8-bit pulse width modulator operates
timer b 87 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r timer b figure 1.14.14 shows the block diagram of timer b. figures 1.14.15 and 1.14.16 show the timer b-related registers. use the timer bi mode register (i = 1, 2) bits 0 and 1 to choose the desired mode. timer b has three operation modes listed as follows: ? timer mode: the timer counts an internal count source. ? event counter mode: the timer counts pulses from an external source or a timer overflow. ? pulse period/pulse width measuring mode: the timer measures an external signal's pulse period or pulse width. figure 1.14.14. block diagram of timer b timer bi mode register symbol address when reset tbimr(i = 1, 2) 039c 16 , 039d 16 00xx0000 2 bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 0 0 : timer mode 0 1 : event counter mode 1 0 : pulse period/pulse width measurement mode 1 1 : must not be set. b1 b0 tck1 mr3 mr1 tmod1 mr0 tmod0 tck0 function varies with each operation mode count source select bit (function varies with each operation mode) operation mode select bit a a a a a a a a a a a a a a a a a function varies with each operation mode nothing is assigned. in an attempt to write to these bits, write 0. the value, if read, turns out to be indeterminate. clock source selection (address 0380 16 ) event counter timer pulse period/pulse width measurement reload register (16) low-order 8 bits high-order 8 bits data bus low-order bits data bus high-order bits f 1 f 8 f 32 tbj overflow (j = i e 1. note, however, must not be set when i = 1) can be selected in only event counter mode count start flag f c32 polarity switching and edge pulse tbi in (i = 1, 2) counter reset circuit counter (16) tbi address tbj timer b1 0393 16 0392 16 must not be set timer b2 0395 16 0394 16 timer b1 clock selection figure 1.14.15. timer b-related registers (1)
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r timer b 88 symbol address when reset tb1 0393 16 , 0392 16 indeterminate tb2 0395 16 , 0394 16 indeterminate b7 b0 b7 b0 (b15) (b8) timer bi register (note) w r ? pulse period / pulse width measurement mode measures a pulse period or width ? timer mode 0000 16 to ffff 16 counts the timer's period function values that can be set ? event counter mode 0000 16 to ffff 16 counts external pulses input or a timer overflow note: read and write data in 16-bit units. a a a a a symbol address when reset cpsrf 0381 16 0xxxxxxx 2 clock prescaler reset flag bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 aaaaaaaaaaaaaaa a aaaaaaaaaaaaa a aaaaaaaaaaaaaaa clock prescaler reset flag 0 : no effect 1 : prescaler is reset (when read, the value is 0) cpsr a a nothing is assigned. in an attempt to write to these bits, write 0. the value, if read, turns out to be indeterminate. symbol address when reset tabsr 0380 16 00 16 count start flag bit name bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa timer b2 count start flag timer b1 count start flag timer a2 count start flag timer a1 count start flag timer a0 count start flag 0 : stops counting 1 : starts counting tb2s tb1s ta2s ta1s ta0s function a a a a a a a a a a a a a a a a a a 0 : stops counting 1 : starts counting reverved bit must always be set to 0 000 figure 1.14.16. timer b-related registers (2)
timer b 89 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r item specification count source f 1 , f 8 , f 32 , f c32 count operation ? counts down ? when the timer underflows, it reloads the reload register contents before continuing counting divide ratio 1/(n+1) n : set value count start condition count start flag is set (= 1) count stop condition count start flag is reset (= 0) interrupt request generation timing the timer underflows tbi in pin function programmable i/o port read from timer count value is read out by reading timer bi register write to timer ? when counting stopped when a value is written to timer bi register, it is written to both reload register and counter ? when counting in progress when a value is written to timer bi register, it is written to only reload register (transferred to counter at next reload time) (1) timer mode in this mode, the timer counts an internally generated count source. (see table 1.14.6.) figure 1.14.17 shows the timer bi mode register in timer mode. table 1.14.6. timer specifications in timer mode timer bi mode register symbol address when reset tbimr(i=1, 2) 039c 16 , 039d 16 00xx0000 2 bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 aa aa a a operation mode select bit 0 0 : timer mode b1 b0 tmod1 tmod0 mr0 invalid in timer mode can be 0 or 1 mr1 mr3 0 0 : f 1 0 1 : f 8 1 0 : f 32 1 1 : f c32 tck1 tck0 count source select bit 0 invalid in timer mode. in an attempt to write to this bit, write 0. the value, if read in timer mode, turns out to be indeterminate. 0 nothing is assiigned. in an attempt to write to this bit, write 0. the value, if read, turns out to be indeterminate. b7 b6 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa figure 1.14.17. timer bi mode register in timer mode
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r timer b 90 item specification count source ? external signals input to tbi in pin ? effective edge of count source can be a rising edge, a falling edge, or falling and rising edges as selected by software count operation ? counts down ? when the timer underflows, it reloads the reload register contents before continuing counting divide ratio 1/(n+1) n : set value count start condition count start flag is set (= 1) count stop condition count start flag is reset (= 0) interrupt request generation timing the timer underflows tbi in pin function count source input read from timer count value can be read out by reading timer bi register write to timer ? when counting stopped when a value is written to timer bi register, it is written to both reload register and counter ? when counting in progress when a value is written to timer bi register, it is written to only reload register (transferred to counter at next reload time) (2) event counter mode in this mode, the timer counts an external signal or an internal timer's overflow. (see table 1.14.7.) figure 1.14.18 shows the timer bi mode register in event counter mode. table 1.14.7. timer specifications in event counter mode figure 1.14.18. timer bi mode register in event counter mode timer bi mode register symbol address when reset tbimr(i=1, 2) 039c 16 , 039d 16 00xx0000 2 bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 aa aa operation mode select bit 0 1 : event counter mode b1 b0 tmod1 tmod0 mr0 count polarity select bit (note 1) mr1 mr3 invalid in event counter mode. in an attempt to write to this bit, write 0. the value, if read in event counter mode, turns out to be indeterminate. tck1 tck0 01 0 0 : counts external signal's falling edges 0 1 : counts external signal's rising edges 1 0 : counts external signal's falling and rising edges 1 1 : must not be set. b3 b2 nothing is assigned. in an attempt to write to this bit, write 0. the value, if read, turns out to be indeterminate. note 1: valid only when input from the tbi in pin is selected as the event clock. if timer's overflow is selected, this bit can be 0 or 1. note 2: set the corresponding port direction register to 0. invalid in event counter mode. can be 0 or 1. event clock select 0 : input from tbi in pin (note 2) 1 : tbj overflow (j = i e 1; however, must not be set, when i = 1) a a a a a a a a a a a a a
timer b 91 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r item specification count source f 1 , f 8 , f 32 , f c32 count operation ? up count ? counter value 0000 16 is transferred to reload register at measurement pulse's effective edge and the timer continues counting count start condition count start flag is set (= 1) count stop condition count start flag is reset (= 0) interrupt request generation timing ? when measurement pulse's effective edge is input (note 1) ? when an overflow occurs. (simultaneously, the timer bi overflow flag changes to 1. assume that the count start flag condition is 1 and then the timer bi overflow flag becomes 1. if the timer bi mode register has a write- access after next count cycle of the timer from the above condition, the timer bi overflow flag becomes 0.) tbi in pin function measurement pulse input read from timer when timer bi register is read, it indicates the reload registers content (measurement result) (note 2) write to timer cannot be written to (3) pulse period/pulse width measurement mode in this mode, the timer measures the pulse period or pulse width of an external signal. (see table 1.14.8.) figure 1.14.19 shows the timer bi mode register in pulse period/pulse width measurement mode. figure 1.14.20 shows the operation timing when measuring a pulse period. figure 1.14.21 shows the operation timing when measuring a pulse width. table 1.14.8. timer specifications in pulse period/pulse width measurement mode figure 1.14.19. timer bi mode register in pulse period/pulse width measurement mode note 1: an interrupt request is not generated when the first effective edge is input after the timer has started counting. note 2: the value read out from the timer bi register is indeterminate until the second effective edge is input after the timer has started counting. timer bi mode register symbol address when reset tbimr(i=1, 2) 039c 16 , 039d 16 00xx0000 2 bit name bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 operation mode select bit 1 0 : pulse period / pulse width measurement mode b1 b0 tmod1 tmod0 mr0 measurement mode select bit mr1 mr3 tck1 tck0 0 1 0 0 : pulse period measurement (interval between measurement pulse's falling edge to falling edge) 0 1 : pulse period measurement (interval between measurement pulse's rising edge to rising edge) 1 0 : pulse width measurement (interval between measurement pulse's falling edge to rising edge, and between rising edge to falling edge) 1 1 : must not be set. function b3 b2 nothing is assigned. in an attempt to write to this bit, write 0. the value, if read, turns out to be indeterminate. count source select bit timer bi overflow flag (note) 0 : timer did not overflow 1 : timer has overflowed 0 0 : f 1 0 1 : f 8 1 0 : f 32 1 1 : f c32 b7 b6 note: it is indeterminate when reset. assume that the count start flag condition is 1 and then the timer bi overflow flag becomes 1. if the timer bi mode register has a write access after next count cycle of the timer from the above condition, the timer bi overflow flag becomes 0. this flag cannot be set to 1 by software. aa aa a a aa a aa a aa a aa a aa aa a a aa
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r timer b 92 figure 1.14.21. operation timing when measuring a pulse width measurement pulse h count source count start flag timer bi interrupt request bit timing at which counter reaches 0000 16 1 1 transfer (measured value) transfer (measured value) l 0 0 timer bi overflow flag 1 0 note 1: counter is initialized at completion of measurement. note 2: timer has overflowed. (note 1) (note 1) (note 1) transfer (measured value) (note 1) cleared to 0 when interrupt request is accepted, or cleared by software. (note 2) transfer (indeterminate value) reload register counter transfer timing figure 1.14.20. operation timing when measuring a pulse period count source measurement pulse count start flag timer bi interrupt request bit timing at which counter reaches 0000 16 h 1 transfer (indeterminate value) l 0 0 timer bi overflow flag 1 0 note 1: counter is initialized at completion of measurement. note 2: timer has overflowed. (note 1) (note 1) when measuring measurement pulse time interval from falling edge to falling edge (note 2) cleared to 0 when interrupt request is accepted, or cleared by software. transfer (measured value) 1 reload register counter transfer timing
serial i/o 93 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r serial i/o serial i/o is configured as three channels: uart0, uart1, uart2. uart0, uart1 and uart2 each have an exclusive timer to generate a transfer clock, so they operate independently of each other. figure 1.16.1 shows the block diagram of uart0, uart1 and uart2. figures 1.16.2 and 1.16.3 show the block diagram of the transmit/receive unit. uarti (i = 0 to 2) has two operation modes: a clock synchronous serial i/o mode and a clock asynchronous serial i/o mode (uart mode). the contents of the serial i/o mode select bits (bits 0 to 2 at addresses 03a0 16 , 03a8 16 and 0378 16 ) determine whether uarti is used as a clock synchronous serial i/o or as a uart. although a few functions are different, uart0, uart1 and uart2 have almost the same functions. uart2, in particular, is used for the sim interface with some extra settings added in clock-asynchronous serial i/o mode (note). it also has the bus collision detection function that generates an interrupt request if the txd pin and the rxd pin are different in level. table 1.16.1 shows the comparison of functions of uart0 through uart2, and figures 1.16.4 to 1.16.9 show the registers related to uarti. note: sim : subscriber identity module note 1: only when clock synchronous serial i/o mode. note 2: only when clock synchronous serial i/o mode and 8-bit uart mode. note 3: only when uart mode. note 4: using for sim interface. uart0 uart1 uart2 function clk polarity selection continuous receive mode selection lsb first / msb first selection impossible transfer clock output from multiple pins selection impossible impossible serial data logic switch impossible sleep mode selection impossible impossible txd, rxd i/o polarity switch impossible possible cmos output txd, rxd port output format cmos output n-channel open-drain output impossible parity error signal output impossible impossible bus collision detection impossible possible possible (note 1) possible (note 1) possible (note 1) possible (note 3) possible (note 1) possible (note 1) possible (note 1) possible (note 1) possible (note 3) possible (note 1) possible (note 2) possible (note 1) possible (note 4) possible (note 4) table 1.16.1. comparison of functions of uart0 through uart2
serial i/o 94 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.16.1. block diagram of uarti (i = 0 to 2) n0 : values set to uart0 bit rate generator (u0brg) n1 : values set to uart1 bit rate generator (u1brg) n2 : values set to uart2 bit rate generator (u2brg) rxd 2 reception control circuit transmission control circuit 1 / (n 2 +1) 1/16 1/16 1/2 bit rate generator (address 0379 16 ) clock synchronous type (when internal clock is selected) uart reception clock synchronous type uart transmission clock synchronous type clock synchronous type (when internal clock is selected) clock synchronous type (when external clock is selected) receive clock transmit clock clk 2 cts 2 / rts 2 f 1 f 8 f 32 vcc rts 2 cts 2 txd 2 (uart2) rxd polarity reversing circuit txd polarity reversing circuit rxd 0 1 / (n 0 +1) 1/2 bit rate generator (address 03a1 16 ) clock synchronous type (when internal clock is selected) uart reception clock synchronous type uart transmission clock synchronous type clock synchronous type (when internal clock is selected) clock synchronous type (when external clock is selected) receive clock transmit clock clk 0 clock source selection cts 0 / rts 0 f 1 f 8 f 32 reception control circuit transmission control circuit internal external vcc rts 0 cts 0 txd 0 transmit/ receive unit rxd 1 1 / (n 1 +1) 1/16 1/16 1/2 bit rate generator (address 03a9 16 ) clock synchronous type (when internal clock is selected) uart reception clock synchronous type uart transmission clock synchronous type clock synchronous type (when internal clock is selected) clock synchronous type (when external clock is selected) receive clock transmit clock clk 1 clock source selection f 1 f 8 f 32 reception control circuit transmission control circuit internal external rts 1 cts 1 txd 1 (uart1) (uart0) clk polarity reversing circuit clk polarity reversing circuit cts/rts disabled clock output pin select switch cts 1 / rts 1 / clks 1 cts/rts disabled cts/rts selected cts/rts disabled v cc cts/rts disabled cts/rts selected cts/rts disabled cts/rts disabled cts/rts selected clk polarity reversing circuit internal external clock source selection transmit/ receive unit transmit/ receive unit 1/16 1/16
serial i/o 95 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.16.2. block diagram of uarti (i = 0, 1) transmit/receive unit sp sp par 2sp 1sp uart uart (7 bits) uart (8 bits) uart (7 bits) uart (9 bits) clock synchronous type clock synchronous type txdi uarti transmit register par enabled par disabled d 8 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 sp: stop bit par: parity bit uarti transmit buffer register msb/lsb conversion circuit uart (8 bits) uart (9 bits) clock synchronous type uarti receive buffer register uarti receive register 2sp 1sp par enabled par disabled uart uart (7 bits) uart (9 bits) clock synchronous type clock synchronous type uart (7 bits) uart (8 bits) rxdi clock synchronous type uart (8 bits) uart (9 bits) address 03a6 16 address 03a7 16 address 03ae 16 address 03af 16 address 03a2 16 address 03a3 16 address 03aa 16 address 03ab 16 data bus low-order bits msb/lsb conversion circuit d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 d 8 0000000 sp sp par 0 data bus high-order bits
serial i/o 96 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r sp sp par 2sp 1sp uart uart (7 bits) uart (8 bits) uart(7 bits) uart (9 bits) clock synchronous type clock synchronous type data bus low-order bits txd2 uart2 transmit register par disabled par enabled d 8 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 uart2 transmit buffer register uart (8 bits) uart (9 bits) clock synchronous type uart2 receive buffer register uart2 receive register 2sp 1sp uart (7 bits) uart (8 bits) uart(7 bits) uart (9 bits) clock synchronous type clock synchronous type rxd2 uart (8 bits) uart (9 bits) address 037e 16 address 037f 16 address 037a 16 address 037b 16 data bus high-order bits d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 d 8 0000000 sp sp par 0 reverse no reverse error signal output circuit rxd data reverse circuit error signal output enable error signal output disable reverse no reverse logic reverse circuit + msb/lsb conversion circuit logic reverse circuit + msb/lsb conversion circuit par enabled par disabled uart clock synchronous type txd data reverse circuit sp: stop bit par: parity bit figure 1.16.3. block diagram of uart2 transmit/receive unit
serial i/o 97 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.16.4. serial i/o-related registers (1) b7 uarti bit rate generator (note 1, 2) b0 symbol address when reset u0brg 03a1 16 indeterminate u1brg 03a9 16 indeterminate u2brg 0379 16 indeterminate function assuming that set value = n, brgi divides the count source by n + 1 00 16 to ff 16 values that can be set w r aa b7 b0 (b15) (b8) b7 b0 uarti transmit buffer register (note) function transmit data nothing is assigned. in an attempt to write to these bits, write 0. the value, if read, turns out to be indeterminate. symbol address when reset u0tb 03a3 16 , 03a2 16 indeterminate u1tb 03ab 16 , 03aa 16 indeterminate u2tb 037b 16 , 037a 16 indeterminate w r aa (b15) symbol address when reset u0rb 03a7 16 , 03a6 16 indeterminate u1rb 03af 16 , 03ae 16 indeterminate u2rb 037f 16 , 037e 16 indeterminate b7 b0 (b8) b7 b0 uarti receive buffer register function (during uart mode) function (during clock synchronous serial i/o mode) bit name bit symbol 0 : no framing error 1 : framing error found 0 : no parity error 1 : parity error found 0 : no error 1 : error found note 1: bits 15 through 12 are set to 0 when the serial i/o mode select bit (bits 2 to 0 at addresses 03a0 16 , 03a8 16 and 0378 16 ) are set to 000 2 or the receive enable bit is set to 0. (bit 15 is set to 0 when bits 14 to 12 all are set to 0.) bits 14 and 13 are also set to 0 when the lower byte of the uarti receive buffer register (addresses 03a6 16 , 03ae 16 and 037e 16 ) is read out. note 2: arbitration lost detecting flag is allocated to u2rb and noting but 0 may be written. nothing is assigned in bit 11 of u0rb and u1rb. when write, set 0. the value, if read, turns out to be 0. invalid invalid invalid oer fer per sum overrun error flag (note 1) framing error flag (note 1) parity error flag (note 1) error sum flag (note 1) 0 : no overrun error 1 : overrun error found 0 : no overrun error 1 : overrun error found nothing is assigned. in an attempt to write to these bits, write 0. the value, if read, turns out to be 0. receive data w r receive data a a a a a a abt arbitration lost detecting flag (note 2) invalid 0 : not detected 1 : detected a aa note 1: write a value to this register while transmit/receive halts. note 2: use mov instruction to write to this register. note: use mov instruction to write to this register.
serial i/o 98 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r uarti transmit/receive mode register symbol address when reset uimr(i=0,1) 03a0 16 , 03a8 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 bit name bit symbol w r must always be 001 0 0 0 : serial i/o invalid 0 1 0 : must not be set. 0 1 1 : must not be set. 1 1 1 : must not be set. b2 b1 b0 ckdir smd1 smd0 serial i/o mode select bit smd2 internal/external clock select bit stps pry prye slep parity enable bit 0 : internal clock 1 : external clock (note) stop bit length select bit odd/even parity select bit sleep select bit 0 : one stop bit 1 : two stop bits 0 : parity disabled 1 : parity enabled 0 : sleep mode deselected 1 : sleep mode selected 1 0 0 : transfer data 7 bits long 1 0 1 : transfer data 8 bits long 1 1 0 : transfer data 9 bits long 0 0 0 : serial i/o invalid 0 1 0 : must not be set. 0 1 1 : must not be set. 1 1 1 : must not be set. b2 b1 b0 0 : internal clock 1 : external clock (note) invalid valid when bit 6 = 1 0 : odd parity 1 : even parity invalid invalid must always be 0 function (during uart mode) function (during clock synchronous serial i/o mode) uart2 transmit/receive mode register symbol address when reset u2mr 0378 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 bit name bit symbol w r must always be 001 0 0 0 : serial i/o invalid 0 1 0 : (note 1) 0 1 1 : must not be set. 1 1 1 : must not be set. b2 b1 b0 ckdir smd1 smd0 serial i/o mode select bit smd2 internal/external clock select bit stps pry prye iopol parity enable bit 0 : internal clock 1 : external clock (note 2) stop bit length select bit odd/even parity select bit txd, rxd i/o polarity reverse bit 0 : one stop bit 1 : two stop bits 0 : parity disabled 1 : parity enabled 0 : no reverse 1 : reverse usually set to 0 1 0 0 : transfer data 7 bits long 1 0 1 : transfer data 8 bits long 1 1 0 : transfer data 9 bits long 0 0 0 : serial i/o invalid 0 1 0 : must not be set. 0 1 1 : must not be set. 1 1 1 : must not be set. b2 b1 b0 invalid valid when bit 6 = 1 0 : odd parity 1 : even parity invalid invalid 0 : no reverse 1 : reverse usually set to 0 function (during uart mode) function (during clock synchronous serial i/o mode) a aa a aa a aa a aa a aa a a aa aa a aa a aa a aa a aa a aa a aa a aa a aa a a aa aa a aa note 1: bit 2 to bit 0 are set to 010 2 when i 2 c mode is used. note 2: set the corresponding port direction register to 0. must always be 0 note : set the corresponding port direction register to 0. figure 1.16.5. serial i/o-related registers (2)
serial i/o 99 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r uarti transmit/receive control register 0 symbol address when reset uic0(i=0,1) 03a4 16 , 03ac 16 08 16 b7 b6 b5 b4 b3 b2 b1 b0 function (during uart mode) w r function (during clock synchronous serial i/o mode) txept clk1 clk0 crs crd nch ckpol brg count source select bit transmit register empty flag 0 : transmit data is output at falling edge of transfer clock and receive data is input at rising edge 1 : transmit data is output at rising edge of transfer clock and receive data is input at falling edge clk polarity select bit cts/rts function select bit cts/rts disable bit data output select bit 0 0 : f 1 is selected 0 1 : f 8 is selected 1 0 : f 32 is selected 1 1 : must not be set. b1 b0 0 : lsb first 1 : msb first 0 : data present in transmit register (during transmission) 1 : no data present in transmit register (transmission completed) 0 : cts/rts function enabled 1 : cts/rts function disabled (p6 0 and p6 4 function as programmable i/o port) 0 : t x di pin is cmos output 1 : t x di pin is n-channel open-drain output uform transfer format select bit 0 0 : f 1 is selected 0 1 : f 8 is selected 1 0 : f 32 is selected 1 1 : must not be set. b1 b0 valid when bit 4 = 0 0 : cts function is selected (note 1) 1 : rts function is selected (note 2) valid when bit 4 = 0 0 : cts function is selected (note 1) 1 : rts function is selected (note 2) 0 : data present in transmit register (during transmission) 1 : no data present in transmit register (transmission completed) 0: t x di pin is cmos output 1: t x di pin is n-channel open-drain output must always be 0 bit name bit symbol must always be 0 note 1: set the corresponding port direction register to 0. note 2: the settings of the corresponding port register and port direction register are invalid. 0 : cts/rts function enabled 1 : cts/rts function disabled (p6 0 and p6 4 function as programmable i/o port) a a a a a a a a a a a a a a a a a uart2 transmit/receive control register 0 symbol address when reset u2c0 037c 16 08 16 b7 b6 b5 b4 b3 b2 b1 b0 function (during uart mode) w r function (during clock synchronous serial i/o mode) txept clk1 clk0 crs crd ckpol brg count source select bit transmit register empty flag 0 : transmit data is output at falling edge of transfer clock and receive data is input at rising edge 1 : transmit data is output at rising edge of transfer clock and receive data is input at falling edge clk polarity select bit cts/rts function select bit cts/rts disable bit 0 0 : f 1 is selected 0 1 : f 8 is selected 1 0 : f 32 is selected 1 1 : must not be set. b1 b0 0 : lsb first 1 : msb first 0 : data present in transmit register (during transmission) 1 : no data present in transmit register (transmission completed) 0 : cts/rts function enabled 1 : cts/rts function disabled (p7 3 functions programmable i/o port) 0 : txdi pin is cmos output 1 : txdi pin is n-channel open-drain output uform transfer format select bit (note 3) 0 0 : f 1 is selected 0 1 : f 8 is selected 1 0 : f 32 is selected 1 1 : must not be set. b1 b0 valid when bit 4 = 0 0 : cts function is selected (note 1) 1 : rts function is selected (note 2) valid when bit 4 = 0 0 : cts function is selected (note 1) 1 : rts function is selected (note 2) 0 : data present in transmit register (during transmission) 1 : no data present in transmit register (transmission completed) 0: txdi pin is cmos output 1: txdi pin is n-channel open-drain output must always be 0 bit name bit symbol note 1: set the corresponding port direction register to 0. note 2: the settings of the corresponding port register and port direction register are invalid. note 3: only clock synchronous serial i/o mode and 8-bit uart mode are valid. 0 : cts/rts function enabled 1 : cts/rts function disabled (p7 3 functions programmable i/o port) nothing is assigned. in an attempt to write to this bit, write 0. the value, if read, turns out to be 0. 0 : lsb first 1 : msb first a a a a a a a a a a a a a a a a a a a a a a figure 1.16.6. serial i/o-related registers (3)
serial i/o 100 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.16.7. serial i/o-related registers (4) uarti transmit/receive control register 1 symbol address when reset uic1(i=0,1) 03a5 16 , 03ad 16 02 16 b7 b6 b5 b4 b3 b2 b1 b0 bit name bit symbol w r function (during uart mode) function (during clock synchronous serial i/o mode) te ti re ri transmit enable bit receive enable bit receive complete flag transmit buffer empty flag 0 : transmission disabled 1 : transmission enabled 0 : data present in transmit buffer register 1 : no data present in transmit buffer register 0 : reception disabled 1 : reception enabled 0 : transmission disabled 1 : transmission enabled 0 : data present in transmit buffer register 1 : no data present in transmit buffer register 0 : reception disabled 1 : reception enabled 0 : no data present in receive buffer register 1 : data present in receive buffer register 0 : no data present in receive buffer register 1 : data present in receive buffer register nothing is assigned. in an attempt to write to these bits, write 0. the value, if read, turns out to be 0. uart2 transmit/receive control register 1 symbol address when reset u2c1 037d 16 02 16 b7 b6 b5 b4 b3 b2 b1 b0 bit name bit symbol w r function (during uart mode) function (during clock synchronous serial i/o mode) te ti re ri transmit enable bit receive enable bit receive complete flag transmit buffer empty flag 0 : transmission disabled 1 : transmission enabled 0 : data present in transmit buffer register 1 : no data present in transmit buffer register 0 : reception disabled 1 : reception enabled 0 : transmission disabled 1 : transmission enabled 0 : data present in transmit buffer register 1 : no data present in transmit buffer register 0 : reception disabled 1 : reception enabled 0 : no data present in receive buffer register 1 : data present in receive buffer register 0 : no data present in receive buffer register 1 : data present in receive buffer register u2irs uart2 transmit interrupt cause select bit 0 : transmit buffer empty (ti = 1) 1 : transmit is completed (txept = 1) 0 : transmit buffer empty (ti = 1) 1 : transmit is completed (txept = 1) u2rrm uart2 continuous receive mode enable bit 0 : continuous receive mode disabled 1 : continuous receive mode enabled must always be "0" data logic select bit 0 : no reverse 1 : reverse 0 : no reverse 1 : reverse u2lch u2ere error signal output enable bit must always be "0" 0 : output disabled 1 : output enabled a a a a a a a a a a a a a a a a a a a a a a a a a a a a
serial i/o 101 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r note: when using multiple pins to output the transfer clock, the following requirements must be met: ? uart1 internal/external clock select bit (bit 3 at address 03a8 16 ) = 0. uart transmit/receive control register 2 symbol address when reset ucon 03b0 16 x0000000 2 b7 b6 b5 b4 b3 b2 b1 b0 bit name bit symbol w r function (during uart mode) function (during clock synchronous serial i/o mode) clkmd0 clkmd1 reserved bit uart0 transmit interrupt cause select bit uart0 continuous receive mode enable bit 0 : continuous receive mode disabled 1 : continuous receive mode enable uart1 continuous receive mode enable bit clk/clks select bit 0 uart1 transmit interrupt cause select bit 0 : transmit buffer empty (tl = 1) 1 : transmission completed (txept = 1) 0 : transmit buffer empty (tl = 1) 1 : transmission completed (txept = 1) 0 : normal mode (clk output is clk1 only) 1 : transfer clock output from multiple pins function selected 0 : continuous receive mode disabled 1 : continuous receive mode enabled nothing is assigned. in an attempt to write to this bit, write 0. the value, if read, turns out to be indeterminate. 0 : transmit buffer empty (tl = 1) 1 : transmission completed (txept = 1) 0 : transmit buffer empty (tl = 1) 1 : transmission completed (txept = 1) must always be 0 u0irs u1irs u0rrm u1rrm invalid clk/clks select bit 1 (note) valid when bit 5 = 1 0 : clock output to clk1 1 : clock output to clks1 a aa a aa a aa a a aa aa a aa a aa a aa uart2 special mode register symbol address when reset u2smr 0377 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 bit name bit symbol w r function (during uart mode) function (during clock synchronous serial i/o mode) abscs acse sss i 2 c mode select bit bus busy flag 0 : stop condition detected 1 : start condition detected scll sync output enable bit bus collision detect sampling clock select bit arbitration lost detecting flag control bit 0 : normal mode 1 : i 2 c mode 0 : update per bit 1 : update per byte iicm abc bbs lsyn 0 : ordinary 1 : falling edge of r x d 2 0 : disabled 1 : enabled transmit start condition select bit must always be 0 0 : rising edge of transfer clock 1 : underflow signal of timer a0 auto clear function select bit of transmit enable bit a a a a a a a a a a a a a a a a a a a a a a 0 : no auto clear function 1 : auto clear at occurrence of bus collision must always be 0 must always be 0 must always be 0 must always be 0 must always be 0 must always be 0 note 1: nothing but 0 may be written. note 2: when not in i 2 c mode, do not set this bit by writing a 1. during normal mode, set it to 0. when this bit = 0, uart2 special mode register 3 (u2smr3 at address 0375 16 ) bits 7 to 5 (dl2 to dl0 = sda digital delay setup bits) are initialized to 000, with the analog delay circuit selected. also, when sdds = 0, the u2smr3 register cannot be read or written to. note 3: when analog delay is selected, only the analog delay value is effective; when digital delay is selected, only the digital delay value is effective. (note1) a a a a sdds sda digital delay select bit (note 2, note 3) must always be 0 0 : analog delay output is selected 1 : digital delay output is selected (must always be 0 when not using i c mode) 2 must always be set to 0 0 must always be 0 must always be 0 figure 1.16.8. serial i/o-related registers (5)
serial i/o 102 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.16.9. serial i/o-related registers (6) uart2 special mode register 2 (i c bus exclusive use register) symbol address when reset u2smr2 0376 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 bit name bit symbol w r function (i 2 c bus exclusive use) stac swc2 sdhi i c mode select bit 2 scl wait output bit 0 : disabled 1 : enabled sda output stop bit uart2 initialization bit clock-synchronous bit refer to table 1.16.11 0 : disabled 1 : enabled iicm2 csc swc als 0 : disabled 1 : enabled sda output disable bit scl wait output bit 2 a a a a a a a a a a a a a a a a a a 0: enabled 1: disabled (high impedance) 0 : disabled 1 : enabled 0: uart2 clock 1: 0 output 2 shtc start/stop condition control bit 1: set this bit to 1 in i 2 c mode (refer to table 1.16.12) a a 2 uart2 special mode register 3 (i c bus exclusive use register) symbol address when reset u2smr3 0375 16 indeterminate (however, when sdds = 1, the initial value is 00 16 ) b7 b6 b5 b4 b3 b2 b1 b0 bit name bit symbol w r function (i c bus exclusive use register) dl2 sda digital delay setup bit (note 1, note 2, note 3, note 4) dl0 dl1 a a a a a a 0 0 0 : analog delay is selected 0 0 1 : 1 to 2 cycle(s) of 1/f(x in ) 0 1 0 : 2 to 3 cycles of 1/f(x in ) 0 1 1 : 3 to 4 cycles of 1/f(x in ) 1 0 0 : 4 to 5 cycles of 1/f(x in ) 1 0 1 : 5 to 6 cycles of 1/f(x in ) 1 1 0 : 6 to 7 cycles of 1/f(x in ) 1 1 1 : 7 to 8 cycles of 1/f(x in ) 2 nothing is assigned. in an attempt to write to these bits, write 0. the value, if read, turns out to be indeterminate. however, when sdds = 1, the value 0 is read out (note 1) 2 b7 b6 b5 note 1: this bit can be read or written to when uart2 special mode register (u2smr at address 0377 16 ) bit 7 (sdds: sda digital delay select bit) = 1. when the initial value of uart2 special mode register 3 (u2smr3) is read after setting sdds = 1, the value is 00 16 . when writing to uart2 special mode register 3 (u2smr3) after setting sdds = 1, be sure to write 0's to bits 0e4. when sdds = 0, this register cannot be written to; when read, the value is indeterminate. note 2: these bits are initialized to 000 when sdds = 0, with the analog delay circuit selected. after a reset, these bits are set to 000, with the analog delay circuit selected. however, because these bits can be read only when sdds = 1, the value read from these bits when sdds = 0 is indeterminate. note 3: when analog delay is selected, only the analog delay value is effective; when digital delay is selected, only the digital delay value is effective. note 4: the amount of delay varies with the load on scl and sda pins. also, when using an external clock, the amount of delay increases by about 100 ns, so be sure to take this into account when using the device. digital delay is selected
clock synchronous serial i/o mode 103 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r (1) clock synchronous serial i/o mode the clock synchronous serial i/o mode uses a transfer clock to transmit and receive data. tables 1.16.2 and 1.16.3 list the specifications of the clock synchronous serial i/o mode. figure 1.16.10 shows the uarti transmit/receive mode register. table 1.16.2. specifications of clock synchronous serial i/o mode (1) item specification transfer data format ? transfer data length: 8 bits transfer clock ? when internal clock is selected (bit 3 at addresses 03a0 16 , 03a8 16 , 0378 16 = 0) : fi/ 2(n+1) (note 1) fi = f 1 , f 8 , f 32 ? when external clock is selected (bit 3 at addresses 03a0 16 , 03a8 16 , 0378 16 = 1) : input from clki pin transmission/reception control _______ _______ _______ _______ ? cts function, rts function, cts and rts function invalid: selectable transmission start condition ? to start transmission, the following requirements must be met: _ transmit enable bit (bit 0 at addresses 03a5 16 , 03ad 16 , 037d 16 ) = 1 _ transmit buffer empty flag (bit 1 at addresses 03a5 16 , 03ad 16 , 037d 16 ) = 0 _______ _______ _ when cts function selected, cts input level = l ? furthermore, if external clock is selected, the following requirements must also be met: _ clki polarity select bit (bit 6 at addresses 03a4 16 , 03ac 16 , 037c 16 ) = 0: clki input level = h _ clki polarity select bit (bit 6 at addresses 03a4 16 , 03ac 16 , 037c 16 ) = 1: clki input level = l reception start condition ? to start reception, the following requirements must be met: _ receive enable bit (bit 2 at addresses 03a5 16 , 03ad 16 , 037d 16 ) = 1 _ transmit enable bit (bit 0 at addresses 03a5 16 , 03ad 16 , 037d 16 ) = 1 _ transmit buffer empty flag (bit 1 at addresses 03a5 16 , 03ad 16 , 037d 16 ) = 0 ? furthermore, if external clock is selected, the following requirements must also be met: _ clki polarity select bit (bit 6 at addresses 03a4 16 , 03ac 16 , 037c 16 ) = 0: clki input level = h _ clki polarity select bit (bit 6 at addresses 03a4 16 , 03ac 16 , 037c 16 ) = 1: clki input level = l ? when transmitting _ transmit interrupt cause select bit (bits 0, 1 at address 03b0 16 , bit 4 at address 037d 16 ) = 0: interrupts requested when data transfer from uarti transfer buffer register to uarti transmit register is completed _ transmit interrupt cause select bit (bits 0, 1 at address 03b0 16 , bit 4 at address 037d 16 ) = 1: interrupts requested when data transmission from uarti transfer register is completed ? when receiving _ interrupts requested when data transfer from uarti receive register to uarti receive buffer register is completed error detection ? overrun error (note 2) this error occurs when the next data is ready before contents of uarti receive buffer register are read out interrupt request generation timing note 1: n denotes the value 00 16 to ff 16 that is set to the uart bit rate generator. note 2: if an overrun error occurs, the uarti receive buffer will have the next data written in. note also that the uarti receive interrupt request bit does not change.
clock synchronous serial i/o mode 104 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r item specification select function ? clk polarity selection whether transmit data is output/input timing at the rising edge or falling edge of the transfer clock can be selected ? lsb first/msb first selection whether transmission/reception begins with bit 0 or bit 7 can be selected ? continuous receive mode selection reception is enabled simultaneously by a read from the receive buffer register ? transfer clock output from multiple pins selection (uart1) uart1 transfer clock can be chosen by software to be output from one of the two pins set ? switching serial data logic (uart2) whether to reverse data in writing to the transmission buffer register or reading the reception buffer register can be selected. ? txd, rxd i/o polarity reverse (uart2) this function is reversing txd port output and rxd port input. all i/o data level is reversed. table 1.16.3. specifications of clock synchronous serial i/o mode (2)
clock synchronous serial i/o mode 105 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.16.10. uarti transmit/receive mode register in clock synchronous serial i/o mode symbol address when reset uimr(i=0,1) 03a0 16 , 03a8 16 00 16 ckdir uarti transmit/receive mode registers internal/external clock select bit stps pry prye slep 0 : internal clock 1 : external clock (note) bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 0 (must always be 0 in clock synchronous serial i/o mode) 01 0 smd0 smd1 smd2 serial i/o mode select bit 0 0 1 : clock synchronous serial i/o mode b2 b1 b0 0 invalid in clock synchronous serial i/o mode symbol address when reset u2mr 0378 16 00 16 ckdir uart2 transmit/receive mode register internal/external clock select bit stps pry prye iopol 0 : internal clock 1 : external clock (note 2) bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 01 0 smd0 smd1 smd2 serial i/o mode select bit 0 0 1 : clock synchronous serial i/o mode b2 b1 b0 0 invalid in clock synchronous serial i/o mode txd, rxd i/o polarity reverse bit (note 1) 0 : no reverse 1 : reverse note 1: usually set to 0. note 2: set the corresponding port direction register to 0. a aa a a aa aa a aa a aa a a aa aa a aa a a aa aa a aa a aa a a aa aa a aa a aa a aa a aa a aa a a aa aa note : set the corresponding port direction register to 0.
clock synchronous serial i/o mode 106 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r table 1.16.4 lists the functions of the input/output pins during clock synchronous serial i/o mode. this table shows the pin functions when the transfer clock output from multiple pins function is not selected. note that for a period from when the uarti operation mode is selected to when transfer starts, the txdi pin outputs an h. (if the n-channel open-drain is selected, this pin is in floating state.) table 1.16.4. input/output pin functions in clock synchronous serial i/o mode pin name function method of selection txdi (p6 3 , p6 7 , p7 0 ) serial data output serial data input transfer clock output transfer clock input programmable i/o port (outputs dummy data when performing reception only) rxdi (p6 2 , p6 6 , p7 1 ) clki (p6 1 , p6 5 , p7 2 ) internal/external clock select bit (bit 3 at address 03a0 16 , 03a8 16 , 0378 16 ) = 0 internal/external clock select bit (bit 3 at address 03a0 16 , 03a8 16 , 0378 16 ) = 1 port p6 1 , p6 5 and p7 2 direction register (bits 1 and 5 at address 03ee 16 , bit 2 at address 03ef 16 ) = 0 port p6 2 , p6 6 and p7 1 direction register (bits 2 and 6 at address 03ee 16 , bit 1 at address 03ef 16 )= 0 (can be used as an input port when performing transmission only) cts/rts disable bit (bit 4 at address 03a4 16 , 03ac 16 , 037c 16 ) =0 cts/rts function select bit (bit 2 at address 03a4 16 , 03ac 16 , 037c 16 ) = 0 port p6 0 , p6 4 and p7 3 direction register (bits 0 and 4 at address 03ee 16 , bit 3 at address 03ef 16 ) = 0 cts/rts disable bit (bit 4 at address 03a4 16 , 03ac 16 , 037c 16) = 0 cts/rts function select bit (bit 2 at address 03a4 16 , 03ac 16 , 037c 16 ) = 1 cts/rts disable bit (bit 4 at address 03a4 16 , 03ac 16 , 037c 16 ) = 1 cts input rts output ctsi/rtsi (p6 0 , p6 4 , p7 3 ) (when transfer clock output from multiple pins is not selected)
clock synchronous serial i/o mode 107 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.16.11. typical transmit/receive timings in clock synchronous serial i/o mode ? example of transmit timing (when internal clock is selected) d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 tc t clk stopped pulsing because transfer enable bit = 0 data is set in uarti transmit buffer register tc = tclk = 2(n + 1) / fi fi: frequency of brgi count source (f 1 , f 8 , f 32 ) n: value set to brgi transfer clock transmit enable bit (te) transmit buffer empty flag (tl) clki txdi transmit register empty flag (txept) h l 0 1 0 1 0 1 ctsi the above timing applies to the following settings: ? internal clock is selected. ? cts function is selected. ? clk polarity select bit = 0. ? transmit interrupt cause select bit = 0. transmit interrupt request bit (ir) 0 1 stopped pulsing because cts = h transferred from uarti transmit buffer register to uarti transmit register shown in ( ) are bit symbols. cleared to 0 when interrupt request is accepted, or cleared by software 1 / f ext dummy data is set in uarti transmit buffer register transmit enable bit (te) transmit buffer empty flag (tl) clki rxdi receive complete flag (rl) rtsi h l 0 1 0 1 0 1 receive enable bit (re) 0 1 receive data is taken in transferred from uarti transmit buffer register to uarti transmit register read out from uarti receive buffer register the above timing applies to the following settings: ? external clock is selected. ? rts function is selected. ? clk polarity select bit = 0. f ext : frequency of external clock transferred from uarti receive register to uarti receive buffer register receive interrupt request bit (ir) 0 1 d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 d 0 d 1 d 2 d 3 d 4 d 5 shown in ( ) are bit symbols. meet the following conditions are met when the clk input before data reception = h ? transmit enable bit 1 ? receive enable bit 1 ? dummy data write to uarti transmit buffer register cleared to 0 when interrupt request is accepted, or cleared by software ? example of receive timing (when external clock is selected)
clock synchronous serial i/o mode 108 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r (a) polarity select function as shown in figure 1.16.12, the clk polarity select bit (bit 6 at addresses 03a4 16 , 03ac 16 , 037c 16 ) allows selection of the polarity of the transfer clock. ? when clk polarity select bit = 1 note 2: the clki pin level when not transferring data is l. d 1 d 2 d 3 d 4 d 5 d 6 d 7 d 1 d 2 d 3 d 4 d 5 d 6 d 7 d 0 d 0 t x d i r x d i clk i ? when clk polarity select bit = 0 note 1: the clki pin level when not transferring data is h. d 1 d 2 d 3 d 4 d 5 d 6 d 7 d0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 d 0 t x d i r x d i clk i figure 1.16.12. polarity of transfer clock (b) lsb first/msb first select function as shown in figure 1.16.13, when the transfer format select bit (bit 7 at addresses 03a4 16 , 03ac 16 , 037c 16 ) = 0, the transfer format is lsb first; when the bit = 1, the transfer format is msb first. figure 1.16.13. transfer format lsb first ? when transfer format select bit = 0 d0 d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 d 1 d 2 d 3 d 4 d 5 d 6 d 7 t x d i r x d i clk i ? when transfer format select bit = 1 d 6 d 5 d 4 d 3 d 2 d 1 d 0 d 7 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 t x d i r x d i clk i msb first note: this applies when the clk polarity select bit = 0.
clock synchronous serial i/o mode 109 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r (c) transfer clock output from multiple pins function (uart1) this function allows the setting two transfer clock output pins and choosing one of the two to output a clock by using the clk and clks select bit (bits 4 and 5 at address 03b0 16 ). (see figure 1.16.14.) the multiple pins function is valid only when the internal clock is selected for uart1. figure 1.16.14. the transfer clock output from the multiple pins function usage microcomputer t x d 1 (p6 7 ) clks 1 (p6 4 ) clk 1 (p6 5 ) in clk in clk note: this applies when the internal clock is selected and transmission is performed only in clock synchronous serial i/o mode. (d) continuous receive mode if the continuous receive mode enable bit (bits 2 and 3 at address 03b0 16 , bit 5 at address 037d 16 ) is set to 1, the unit is placed in continuous receive mode. in this mode, when the receive buffer register is read out, the unit simultaneously goes to a receive enable state without having to set dummy data to the transmit buffer register back again. (e) serial data logic switch function (uart2) when the data logic select bit (bit6 at address 037d 16 ) = 1, and writing to transmit buffer register or reading from receive buffer register, data is reversed. figure 1.16.15 shows the example of serial data logic switch timing. figure 1.16.15. serial data logic switch timing d0 d1 d2 d3 d4 d5 d6 d7 d0 d1 d2 d3 d4 d5 d6 d7 transfer clock txd 2 (no reverse) txd 2 (reverse) h l h l h l ?when lsb first
clock asynchronous serial i/o (uart) mode 110 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r item specification transfer data format ? character bit (transfer data): 7 bits, 8 bits, or 9 bits as selected ? start bit: 1 bit ? parity bit: odd, even, or nothing as selected ? stop bit: 1 bit or 2 bits as selected transfer clock ? when internal clock is selected (bit 3 at addresses 03a0 16 , 03a8 16 , 0378 16 = 0) : fi/16(n+1) (note 1) fi = f 1 , f 8 , f 32 ? when external clock is selected (bit 3 at addresses 03a0 16 , 03a8 16 =1) : f ext /16(n+1) (note 1) (note 2) (do not set external clock for uart2) transmission/reception control _______ _______ _______ _______ ? cts function, rts function, cts and rts function invalid: selectable transmission start condition ? to start transmission, the following requirements must be met: - transmit enable bit (bit 0 at addresses 03a5 16 , 03ad 16 , 037d 16 ) = 1 - transmit buffer empty flag (bit 1 at addresses 03a5 16 , 03ad 16 , 037d 16 ) = 0 _______ _______ - when cts function selected, cts input level = l reception start condition ? to start reception, the following requirements must be met: - receive enable bit (bit 2 at addresses 03a5 16 , 03ad 16 , 037d 16 ) = 1 - start bit detection interrupt request ? when transmitting generation timing - t ransmit interrupt cause select bits (bits 0,1 at address 03b0 16 , bit4 at address 037d 16 ) = 0: interrupts requested when data transfer from uarti transfer buffer register to uarti transmit register is completed - transmit interrupt cause select bits (bits 0, 1 at address 03b0 16 , bit4 at address 037d 16 ) = 1: interrupts requested when data transmission from uarti transfer register is completed ? when receiving - interrupts requested when data transfer from uarti receive register to uarti receive buffer register is completed error detection ? overrun error (note 3) this error occurs when the next data is ready before contents of uarti receive buffer register are read out ? framing error this error occurs when the number of stop bits set is not detected ? parity error this error occurs when if parity is enabled, the number of 1s in parity and character bits does not match the number of 1s set ? error sum flag this flag is set (= 1) when any of the overrun, framing, and parity errors is encountered (2) clock asynchronous serial i/o (uart) mode the uart mode allows transmitting and receiving data after setting the desired transfer rate and transfer data format. tables 1.16.5 and 1.16.6 list the specifications of the uart mode. figure 1.16.16 shows the uarti transmit/receive mode register. table 1.16.5. specifications of uart mode (1) note 1: n denotes the value 00 16 to ff 16 that is set to the uarti bit rate generator. note 2: f ext is input from the clki pin. note 3: if an overrun error occurs, the uarti receive buffer will have the next data written in. note also that the uarti receive interrupt request bit does not change.
clock asynchronous serial i/o (uart) mode 111 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r table 1.16.6. specifications of uart mode (2) item specification select function ? sleep mode selection (uart0, uart1) this mode is used to transfer data to and from one of multiple slave micro- computers ? serial data logic switch (uart2) this function is reversing logic value of transferring data. start bit, parity bit and stop bit are not reversed. ?t x d, r x d i/o polarity switch (uart2) this function is reversing t x d port output and r x d port input. all i/o data level is reversed.
clock asynchronous serial i/o (uart) mode 112 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.16.16. uarti transmit/receive mode register in uart mode symbol address when reset uimr(i=0,1) 03a0 16 , 03a8 16 00 16 ckdir uarti transmit / receive mode registers internal / external clock select bit stps pry prye slep 0 : internal clock 1 : external clock (note) bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 smd0 smd1 smd2 serial i/o mode select bit b2 b1 b0 0 : one stop bit 1 : two stop bits 0 : parity disabled 1 : parity enabled 0 : sleep mode deselected 1 : sleep mode selected 1 0 0 : transfer data 7 bits long 1 0 1 : transfer data 8 bits long 1 1 0 : transfer data 9 bits long valid when bit 6 = 1 0 : odd parity 1 : even parity stop bit length select bit odd / even parity select bit parity enable bit sleep select bit symbol address when reset u2mr 0378 16 00 16 ckdir uart2 transmit / receive mode register internal / external clock select bit stps pry prye iopol must always be 0 bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 smd0 smd1 smd2 serial i/o mode select bit b2 b1 b0 0 : one stop bit 1 : two stop bits 0 : parity disabled 1 : parity enabled 0 : no reverse 1 : reverse 1 0 0 : transfer data 7 bits long 1 0 1 : transfer data 8 bits long 1 1 0 : transfer data 9 bits long valid when bit 6 = 1 0 : odd parity 1 : even parity stop bit length select bit odd / even parity select bit parity enable bit txd, rxd i/o polarity reverse bit (note) a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a note: usually set to 0. note : set the corresponding port direction register to 0.
clock asynchronous serial i/o (uart) mode 113 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r table 1.16.7 lists the functions of the input/output pins during uart mode. note that for a period from when the uarti operation mode is selected to when transfer starts, the txdi pin outputs an h. (if the n- channel open-drain is selected, this pin is in floating state.) table 1.16.7. input/output pin functions in uart mode pin name function method of selection txdi (p6 3 , p6 7 , p7 0 ) serial data output serial data input programmable i/o port transfer clock input programmable i/o port rxdi (p6 2 , p6 6 , p7 1 ) clki (p6 1 , p6 5 , p7 2 ) internal/external clock select bit (bit 3 at address 03a0 16 , 03a8 16 , 0378 16 ) = 0 internal/external clock select bit (bit 3 at address 03a0 16 , 03a8 16 ) = 1 port p6 1 , p6 5 direction register (bits 1 and 5 at address 03ee 16 ) = 0 (do not set external clock for uart2) port p6 2 , p6 6 and p7 1 direction register (bits 2 and 6 at address 03ee 16 , bit 1 at address 03ef 16 )= 0 (can be used as an input port when performing transmission only) cts/rts disable bit (bit 4 at address 03a4 16 , 03ac 16 , 037c 16 ) =0 cts/rts function select bit (bit 2 at address 03a4 16 , 03ac 16 , 037c 16 ) = 0 port p6 0 , p6 4 and p7 3 direction register (bits 0 and 4 at address 03ee 16 , bit 3 at address 03ef 16 ) = 0 cts/rts disable bit (bit 4 at address 03a4 16 , 03ac 16 , 037c 16) = 0 cts/rts function select bit (bit 2 at address 03a4 16 , 03ac 16 , 037c 16 ) = 1 cts/rts disable bit (bit 4 at address 03a4 16 , 03ac 16 , 037c 16 ) = 1 cts input rts output ctsi/rtsi (p6 0 , p6 4 , p7 3 )
clock asynchronous serial i/o (uart) mode 114 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r transmit enable bit(te) transmit buffer empty flag(ti) transmit register empty flag (txept) start bit parity bit txdi ctsi the above timing applies to the following settings : ? parity is enabled. ? one stop bit. ? cts function is selected. ? transmit interrupt cause select bit = 1. 1 0 1 l h 0 1 tc = 16 (n + 1) / fi or 16 (n + 1) / f ext fi : frequency of brgi count source (f 1 , f 8 , f 32 ) f ext : frequency of brgi count source (external clock) n : value set to brgi transmit interrupt request bit (ir) 0 1 cleared to 0 when interrupt request is accepted, or cleared by software transmit enable bit(te) transmit buffer empty flag(ti) txdi transmit register empty flag (txept) 0 1 0 1 0 1 the above timing applies to the following settings : ? parity is disabled. ? two stop bits. ? cts function is disabled. ? transmit interrupt cause select bit = 0. transfer clock tc tc = 16 (n + 1) / fi or 16 (n + 1) / f ext fi : frequency of brgi count source (f 1 , f 8 , f 32 ) f ext : frequency of brgi count source (external clock) n : value set to brgi transmit interrupt request bit (ir) 0 1 shown in ( ) are bit symbols. shown in ( ) are bit symbols. tc transfer clock d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st p d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 sp st p sp d 0 d 1 st stopped pulsing because transmit enable bit = 0 stop bit transferred from uarti transmit buffer register to uarti transmit register start bit the transfer clock stops momentarily as cts is h when the stop bit is checked. the transfer clock starts as the transfer starts immediately cts changes to l. data is set in uarti transmit buffer register d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st sp d 8 d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st d 8 d 0 d 1 st sp sp transferred from uarti transmit buffer register to uarti transmit register stop bit stop bit data is set in uarti transmit buffer register. 0 sp cleared to 0 when interrupt request is accepted, or cleared by software ? example of transmit timing when transfer data is 8 bits long (parity enabled, one stop bit) ? example of transmit timing when transfer data is 9 bits long (parity disabled, two stop bits) figure 1.16.17. typical transmit timings in uart mode(uart0,uart1)
clock asynchronous serial i/o (uart) mode 115 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.16.18. typical transmit timings in uart mode(uart2) d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st p start bit parity bit cleared to 0 when interrupt request is accepted, or cleared by software d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st p tc sp stop bit data is set in uart2 transmit buffer register transferred from uart2 transmit buffer register to uarti transmit register sp transmit enable bit(te) transmit buffer empty flag(ti) transmit register empty flag (txept) 0 1 0 1 0 1 transmit interrupt request bit (ir) 0 1 transfer clock txd 2 the above timing applies to the following settings : ? parity is enabled. ? one stop bit. ? transmit interrupt cause select bit = 1. tc = 16 (n + 1) / fi fi : frequency of brg2 count source (f 1 , f 8 , f 32 ) n : value set to brg2 shown in ( ) are bit symbols. note note: the transmit is started with overflow timing of brg after having written in a value at the transmit buffer in the above t iming. ? example of transmit timing when transfer data is 8 bits long (parity enabled, one stop bit)
clock asynchronous serial i/o (uart) mode 116 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r (b) function for switching serial data logic (uart2) when the data logic select bit (bit 6 of address 037d 16 ) is assigned 1, data is inverted in writing to the transmission buffer register or reading the reception buffer register. figure 1.16.20 shows the ex- ample of timing for switching serial data logic. figure 1.16.20. timing for switching serial data logic st : start bit p : even parity sp : stop bit d0 d1 d2 d3 d4 d5 d6 d7 p sp st sp st d3 d4 d5 d6 d7 p d0 d1 d2 transfer clock txd 2 (no reverse) txd 2 (reverse) h l h l h l ? when lsb first, parity enabled, one stop bit ? example of receive timing when transfer data is 8 bits long (parity disabled, one stop bit) figure 1.16.19. typical receive timing in uart mode (a) sleep mode (uart0, uart1) this mode is used to transfer data between specific microcomputers among multiple microcomputers connected using uarti. the sleep mode is selected when the sleep select bit (bit 7 at addresses 03a0 16 , 03a8 16 ) is set to 1 during reception. in this mode, the unit performs receive operation when the msb of the received data = 1 and does not perform receive operation when the msb = 0. d 0 start bit sampled l receive data taken in brgi count source receive enable bit rxdi transfer clock receive complete flag rtsi stop bit 1 0 0 1 h l the above timing applies to the following settings : ?parity is disabled. ?one stop bit. ?rts function is selected. receive interrupt request bit 0 1 transferred from uarti receive register to uarti receive buffer register reception triggered when transfer clock is generated by falling edge of start bit d 7 d 1 cleared to 0 when interrupt request is accepted, or cleared by software
clock asynchronous serial i/o (uart) mode 117 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r (c) txd, rxd i/o polarity reverse function (uart2) this function is to reverse t x d pin output and r x d pin input. the level of any data to be input or output (including the start bit, stop bit(s), and parity bit) is reversed. set this function to 0 (not to reverse) for usual use. (d) bus collision detection function (uart2) this function is to sample the output level of the t x d pin and the input level of the r x d pin at the rising edge of the transfer clock; if their values are different, then an interrupt request occurs. figure 1.16.21 shows the example of detection timing of a bus collision (in uart mode). figure 1.16.21. detection timing of a bus collision (in uart mode) st : start bit sp : stop bit st st sp sp transfer clock txd 2 rxd 2 bus collision detection interrupt request signal h l h l h l 1 0 bus collision detection interrupt request bit 1 0
clock asynchronous serial i/o (uart) mode 118 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r item specification transfer data format ? transfer data 8-bit uart mode (bit 2 through bit 0 of address 0378 16 = 101 2 ) ? one stop bit (bit 4 of address 0378 16 = 0) ? with the direct format chosen set parity to even (bit 5 and bit 6 of address 0378 16 = 1 and 1 respectively) set data logic to direct (bit 6 of address 037d 16 = 0). set transfer format to lsb (bit 7 of address 037c 16 = 0). ? with the inverse format chosen set parity to odd (bit 5 and bit 6 of address 0378 16 = 0 and 1 respectively) set data logic to inverse (bit 6 of address 037d 16 = 1) set transfer format to msb (bit 7 of address 037c 16 = 1) transfer clock ? with the internal clock chosen (bit 3 of address 0378 16 = 0) : fi / 16 (n + 1) (note 1) : fi=f 1 , f 8 , f 32 (do not set external clock) transmission / reception control _______ _______ ? disable the cts and rts function (bit 4 of address 037c 16 = 1) other settings ? the sleep mode select function is not available for uart2 ? set transmission interrupt factor to transmission completed (bit 4 of address 037d 16 = 1) transmission start condition ? to start transmission, the following requirements must be met: - transmit enable bit (bit 0 of address 037d 16 ) = 1 - transmit buffer empty flag (bit 1 of address 037d 16 ) = 0 r eceptio n start condition ? to start reception, the following requirements must be met: - reception enable bit (bit 2 of address 037d 16 ) = 1 - detection of a start bit ? when transmitting when data transmission from the uart2 transmit register is completed (bit 4 of address 037d 16 = 1) ? when receiving when data transfer from the uart2 receive register to the uart2 receive buffer register is completed error detection ? overrun error (see the specifications of clock-asynchronous serial i/o) (note 2) ? framing error (see the specifications of clock-asynchronous serial i/o) ? parity error (see the specifications of clock-asynchronous serial i/o) - on the reception side, an l level is output from the t x d 2 pin by use of the parity error signal output function (bit 7 of address 037d 16 = 1) when a parity error is detected - on the transmission side, a parity error is detected by the level of input to the r x d 2 pin when a transmission interrupt occurs ? the error sum flag (see the specifications of clock-asynchronous serial i/o) (3) clock-asynchronous serial i/o mode (used for the sim interface) the sim interface is used for connecting the microcomputer with a memory card or the like; adding some extra settings in uart2 clock-asynchronous serial i/o mode allows the user to effect this function. table 1.16.8 shows the specifications of clock-asynchronous serial i/o mode (used for the sim interface). interrupt request generation timing note 1: n denotes the value 00 16 to ff 16 that is set to the uart2 bit rate generator. note 2: if an overrun error occurs, the uart2 receive buffer will have the next data written in. note also that the uart2 receive interrupt request bit does not change. table 1.16.8. specifications of clock-asynchronous serial i/o mode (used for the sim interface)
clock asynchronous serial i/o (uart) mode 119 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.16.22. typical transmit/receive timing in uart mode (used for the sim interface) transmit enable bit(te) transmit buffer empty flag(ti) transmit register empty flag (txept) d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st p start bit parity bit the above timing applies to the following settings : ? parity is enabled. ? one stop bit. ? transmit interrupt cause select bit = 1. 0 1 0 1 0 1 tc = 16 (n + 1) / fi fi : frequency of brg2 count source (f 1 , f 8 , f 32 ) n : value set to brg2 transmit interrupt request bit (ir) 0 1 d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st p shown in ( ) are bit symbols. tc transfer clock sp stop bit data is set in uart2 transmit buffer register sp an l level returns from txd 2 due to the occurrence of a parity error. the level is detected by the interrupt routine. the level is detected by the interrupt routine. receive enable bit (re) receive complete flag (ri) d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st p start bit parity bit rxd 2 the above timing applies to the following settings : ? parity is enabled. ? one stop bit. ? transmit interrupt cause select bit = 0. 0 1 0 1 tc = 16 (n + 1) / fi fi : frequency of brg2 count source (f 1 , f 8 , f 32 ) n : value set to brg2 receive interrupt request bit (ir) 0 1 d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st p sp shown in ( ) are bit symbols. tc transfer clock sp stop bit an l level returns from txd 2 due to the occurrence of a parity error. txd 2 read to receive buffer read to receive buffer d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st p signal conductor level (note 2) d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st p sp sp d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st p d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st p sp sp txd 2 rxd 2 signal conductor level (note 2) note 2: equal in waveform because txd 2 and rxd 2 are connected. transferred from uart2 transmit buffer register to uart2 transmit register cleared to 0 when interrupt request is accepted, or cleared by software cleared to 0 when interrupt request is accepted, or cleared by software note 1: the transmit is started with overflow timing of brg after having written in a value at the transmit buffer in the above timing. note 1
clock asynchronous serial i/o (uart) mode 120 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r (a) function for outputting a parity error signal during reception, with the error signal output enable bit (bit 7 of address 037d 16 ) assigned 1, you can output an l level from the t x d 2 pin when a parity error is detected. and during transmission, comparing with the case in which the error signal output enable bit (bit 7 of address 037d 16 ) is as- signed 0, the transmission completion interrupt occurs in the half cycle later of the transfer clock. therefore parity error signals can be detected by a transmission completion interrupt program. figure 1.16.23 shows the output timing of the parity error signal. figure 1.16.23. output timing of the parity error signal st : start bit p : even parity sp : stop bit d0 d1 d2 d3 d4 d5 d6 d7 p sp st hi-z transfer clock rxd 2 txd 2 receive complete flag h l h l h l 1 ? lsb first 0 (b) direct format/inverse format connecting the sim card allows you to switch between direct format and inverse format. if you choose the direct format, d 0 data is output from txd 2 . if you choose the inverse format, d 7 data is inverted and output from txd 2 . figure 1.16.24 shows the sim interface format. figure 1.16.24. sim interface format p : even parity d0 d1 d2 d3 d4 d5 d6 d7 p transfer clcck txd 2 (direct) txd 2 (inverse) d7 d6 d5 d4 d3 d2 d1 d0 p
clock asynchronous serial i/o (uart) mode 121 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.16.25 shows the example of connecting the sim interface. connect t x d 2 and r x d 2 and apply pull-up. figure 1.16.25. connecting the sim interface microcomputer sim card txd 2 rxd 2
uart2 special mode register 122 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r uart2 special mode register the uart2 special mode register (address 0377 16 ) is used to control uart2 in various ways. figure 1.16.26 shows the uart2 special mode register. bit 0 of the uart2 special mode register (0377 16 ) is used as the i 2 c mode select bit. setting 1 in the i 2 c mode select bit (bit 0) goes the circuit to achieve the i 2 c bus (simplified i 2 c bus) interface effective. table 1.16.9 shows the relation between the i 2 c mode select bit and respective control workings. since this function uses clock-synchronous serial i/o mode, set this bit to 0 in uart mode. figure 1.16.26. uart2 special mode register uart2 special mode register symbol address when reset u2smr 0377 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 bit name bit symbol w r function (during uart mode) function (during clock synchronous serial i/o mode) abscs acse sss i 2 c mode select bit bus busy flag 0 : stop condition detected 1 : start condition detected scl l sync output enable bit bus collision detect sampling clock select bit arbitration lost detecting flag control bit 0 : normal mode 1 : i 2 c mode 0 : update per bit 1 : update per byte iicm abc bbs lsyn 0 : ordinary 1 : falling edge of rxd 2 0 : disabled 1 : enabled transmit start condition select bit must always be 0 0 : rising edge of transfer clock 1 : underflow signal of timer a0 auto clear function select bit of transmit enable bit a a aa aa a aa a a aa aa a aa a aa a aa a aa 0 : no auto clear function 1 : auto clear at occurrence of bus collision must always be 0 must always be 0 must always be 0 must always be 0 must always be 0 must always be 0 note 1: nothing but 0 may be written. note 2: when not in i 2 c mode, do not set this bit by writing a 1. during normal mode, set it to 0. when this bit = 0, uart2 special mode register 3 (u2smr3 at address 0375 16 ) bits 7 to 5 (dl2 to dl0 = sda digital delay setup bits) are initialized to 000, with the analog delay circuit selected. also, when sdds = 0, the u2smr3 register cannot be read or written to. note 3: when analog delay is selected, only the analog delay value is effective; when digital delay is selected, only the digital delay value is effective. (note1) aa a sdds sda digital delay select bit (note 2, note 3) must always be 0 0 : analog delay output is selected 1 : digital delay output is selected (must always be 0 when not using i c mode) 2 uart2 special mode register 3 (i c bus exclusive use register) symbol address when reset u2smr3 0375 16 indeterminate (however, when sdds = 1, the initial value is 00 16 ) b7 b6 b5 b4 b3 b2 b1 b0 bit name bit symbol w r function (i c bus exclusive use register) dl2 sda digital delay setup bit (note 1, note 2, note 3, note 4) dl0 dl1 aa a aa aa a a aa a 0 0 0 : analog delay is selected 0 0 1 : 1 to 2 cycle(s) of 1/f(x in ) 0 1 0 : 2 to 3 cycles of 1/f(x in ) 0 1 1 : 3 to 4 cycles of 1/f(x in ) 1 0 0 : 4 to 5 cycles of 1/f(x in ) 1 0 1 : 5 to 6 cycles of 1/f(x in ) 1 1 0 : 6 to 7 cycles of 1/f(x in ) 1 1 1 : 7 to 8 cycles of 1/f(x in ) 2 nothing is assigned. in an attempt to write to these bits, write 0. the value, if read, turns out to be indeterminate. however, when sdds = 1, the value 0 is read out (note 1) 2 b7 b6 b5 note 1: this bit can be read or written to when uart2 special mode register (u2smr at address 0377 16 ) bit 7 (sdds: sda digital delay select bit) = 1. when the initial value of uart2 special mode register 3 (u2smr3) is read after setting sdds = 1, the value is 00 16 . when writing to uart2 special mode register 3 (u2smr3) after setting sdds = 1, be sure to write 0's to bits 0e4. when sdds = 0, this register cannot be written to; when read, the value is indeterminate. note 2: these bits are initialized to 000 when sdds = 0, with the analog delay circuit selected. after a reset, these bits are set to 000, with the analog delay circuit selected. however, because these bits can be read only when sdds = 1, the value read from these bits when sdds = 0 is indeterminate. note 3: when analog delay is selected, only the analog delay value is effective; when digital delay is selected, only the digital delay value is effective. note 4: the amount of delay varies with the load on scl and sda pins. also, when using an external clock, the amount of delay increases by about 100 ns, so be sure to take this into account when using the device. digital delay is selected
uart2 special mode register 123 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r function normal mode i 2 c mode (note 1) factor of interrupt number 15 (note 2) uart2 transmission no acknowledgment detection (nack) factor of interrupt number 16 (note 2) uart2 reception start condition detection or stop condition detection uart2 transmission output delay not delayed delayed p7 0 at the time when uart2 is in use txd 2 (output) sda (input/output) (note 3) p7 1 at the time when uart2 is in use rxd 2 (input) scl (input/output) p7 2 at the time when uart2 is in use clk 2 p7 2 1 2 3 4 5 6 7 note 1: make the settings given below when i 2 c mode is in use. set 0 1 0 in bits 2, 1, 0 of the uart2 transmission/reception mode register. disable the rts/cts function. choose the msb first function. note 2: follow the steps given below to switch from a factor to another. 1. disable the interrupt of the corresponding number. 2. switch from a factor to another. 3. reset the interrupt request flag of the corresponding number. 4. set an interrupt level of the corresponding number. note 3: set an initial value of sda transmission output when serial i/o is invalid. factor of interrupt number 10 (note 2) bus collision detection acknowledgment detection (ack) noise filter width 15ns 50ns reading p7 1 reading the terminal when 0 is assigned to the direction register reading the terminal regardless of the value of the direction register 8 9 initial value of uart2 output h level (when 0 is assigned to the clk polarity select bit) the value set in latch p7 0 when the port is selected 10 table 1.16.9. features in i 2 c mode p7 0 /txd 2 /sda p7 1 /rxd 2 /scl clk control p7 2 /clk 2 falling edge detection uart2 reception/ack interrupt request to dma0 to dma0 2 p7 0 through p7 2 conforming to the simplified i c bus i/o timer uart2 timer uart2 iicm=1 (sdds=0) or dl=000 (sdds=1) iicm=0 or iicm2=1 iicm=1 and iicm2=0 sdhi noize filter timer uart2 uart2 i/o d t q d t q d t q nack ack uart2 uart2 iicm=1 iicm=0 iicm=0 iicm=1 iicm=1 iicm=0 s r q iicm=1 iicm=0 i/o r q als iicm=0 or dl 000 (sdds=1) sdds=0 or dl=000 sdds=1 and dl 000 swc2 falling edge of 9 bit swc iicm=1 and iicm2=0 iicm=0 or iicm2=1 selector selector selector noize filter noize filter * with iicm set to 1, the port terminal is to be readable even if 1 is assigned to p7 1 of the direction register. port reading external clock internal clock 9th pulse bus collision detection bus collision/start, stop condition detection interrupt request uart2 transmission/ nack interrupt request start condition detection stop condition detection l-synchronous output enabling bit (port p7 1 output data latch) data bus reception register bus busy transmission register arbitration analog delay digital delay (divider) figure 1.16.27. functional block diagram for i 2 c mode
uart2 special mode register 124 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r an attempt to read port p7 1 (scl) results in getting the terminals level regardless of the content of the port direction register. the initial value of sda transmission output goes to the value set in port p7 0 . the interrupt factors of the bus collision detection interrupt, uart2 transmission interrupt, and of uart2 reception interrupt turn to the start/stop condition detection interrupt, acknowledgment non-detection in- terrupt, and acknowledgment detection interrupt respectively. the start condition detection interrupt refers to the interrupt that occurs when the falling edge of the sda terminal (p7 0 ) is detected with the scl terminal (p7 1 ) staying h. the stop condition detection interrupt refers to the interrupt that occurs when the rising edge of the sda terminal (p7 0 ) is detected with the scl terminal (p7 1 ) staying h. the bus busy flag (bit 2 of the uart2 special mode register) is set to 1 by the start condition detection, and set to 0 by the stop condition detection. the acknowledgment non-detection interrupt refers to the interrupt that occurs when the sda terminal level is detected still staying h at the rising edge of the 9th transmission clock. the acknowledgment detection interrupt refers to the interrupt that occurs when sda terminals level is detected already went to l at the 9th transmission clock. bit 1 of the uart2 special mode register (0377 16 ) is used as the arbitration lost detecting flag control bit. arbitration means the act of detecting the nonconformity between transmission data and sda terminal data at the timing of the scl rising edge. this detecting flag is located at bit 11 of the uart2 reception buffer register (037f 16 , 037e 16 ), and 1 is set in this flag when nonconformity is detected. use the arbitration lost detecting flag control bit to choose which way to use to update the flag, bit by bit or byte by byte. when setting this bit to 1 and updated the flag byte by byte if nonconformity is detected, the arbitration lost detecting flag is set to 1 at the falling edge of the 9th transmission clock. if update the flag byte by byte, must judge and clear (0) the arbitration lost detecting flag after complet- ing the first byte acknowledge detect and before starting the next one byte transmission. bit 3 of the uart2 special mode register is used as scl- and l-synchronous output enable bit. setting this bit to 1 goes the p7 1 data register to 0 in synchronization with the scl terminal level going to l. figure 1.16.27 shows the functional block diagram for i 2 c mode. setting 1 in the i 2 c mode select bit (iicm) causes ports p7 0 , p7 1 , and p7 2 to work as data transmission-reception terminal sda, clock input- output terminal scl, and port p7 2 respectively. a delay circuit is added to the sda transmission output, so the sda output changes after scl fully goes to l. the sda digital delay select bit (bit 7 at address 0377 16 ) can be used to select between analog delay and digital delay. when digital delay is selected, the amount of delay can be selected in the range of 2 cycles to 8 cycles of f1 using uart2 special mode register 3 (at address 0375 16 ). delay circuit select conditions are shown in table 1.16.10. table 1.16.10. delay circuit select conditions digital delay is selected 001 111 000 (000) 1 0 1 1 1 analog delay is selected no delay 0 0 (000) iicm sdds dl register value contents when digital delay is selected, no analog delay is added. only digital delay is effective. when dl is set to 000, analog delay is selected no matter what value is set in sdds. when sdds is set to 0, dl is initialized, so that dl =000. when iicm = 0, no delay circuit is selected. when iicm = 0, however, always make sure sdds = 0. to
uart2 special mode register 125 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r 1. bus collision detect sampling clock select bit (bit 4 of the uart2 special mode register) 0: rising edges of the transfer clock clk timer a0 1: timer a0 overflow 2. auto clear function select bit of transmt enable bit (bit 5 of the uart2 special mode register) clk txd/rxd bus collision detect interrupt request bit transmit enable bit 3. transmit start condition select bit (bit 6 of the uart2 special mode register) clk txd enabling transmission clk txd rxd with "1: falling edge of rxd 2 " selected 0: in normal state txd/rxd figure 1.16.28. some other functions added some other functions added are explained here. figure 1.16.28 shows their workings. bit 4 of the uart2 special mode register is used as the bus collision detect sampling clock select bit. the bus collision detect interrupt occurs when the r x d 2 level and t x d 2 level do not match, but the nonconfor- mity is detected in synchronization with the rising edge of the transfer clock signal if the bit is set to 0. if this bit is set to 1, the nonconformity is detected at the timing of the overflow of timer a0 rather than at the rising edge of the transfer clock. bit 5 of the uart2 special mode register is used as the auto clear function select bit of transmit enable bit. setting this bit to 1 automatically resets the transmit enable bit to 0 when 1 is set in the bus collision detect interrupt request bit (nonconformity). bit 6 of the uart2 special mode register is used as the transmit start condition select bit. setting this bit to 1 starts the txd transmission in synchronization with the falling edge of the rxd terminal.
uart2 special mode register 2 126 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r uart2 special mode register 2 uart2 special mode register 2 (address 0376 16 ) is used to further control uart2 in i 2 c mode. figure 1.16.29 shows the uart2 special mode register 2. uart2 special mode register 2 (i c bus exclusive use register) symbol address when reset u2smr2 0376 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 bit name bit symbol w r function stac swc2 sdhi i c mode select bit 2 scl wait output bit 0 : disabled 1 : enabled sda output stop bit uart2 initialization bit clock-synchronous bit refer to table 1.16.11 0 : disabled 1 : enabled iicm2 csc swc als 0 : disabled 1 : enabled sda output disable bit scl wait output bit 2 aa aa a a aa aa a a aa a aa a aa a aa a aa a 0: enabled 1: disabled (high impedance) 0 : disabled 1 : enabled 0: uart2 clock 1: 0 output 2 shtc start/stop condition control bit 1: set this bit to 1 in i 2 c mode (refer to table 1.16.12) aa a 2 figure 1.16.29. uart2 special mode register 2
uart2 special mode register 2 127 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r bit 0 of the uart2 special mode register 2 (address 0376 16 ) is used as the i 2 c mode select bit 2. table 1.16.11 shows the types of control to be changed by i 2 c mode select bit 2 when the i 2 c mode select bit is set to 1. table 1.16.12 shows the timing characteristics of detecting the start condition and the stop condition. set the start/stop condition control bit (bit 7 of uart2 special mode register 2) to 1 in i 2 c mode. function iicm2 = 1 iicm2 = 0 factor of interrupt number 15 no acknowledgment detection (nack) uart2 transmission (the rising edge of the final bit of the clock) factor of interrupt number 16 acknowledgment detection (ack) uart2 reception (the falling edge of the final bit of the clock) 1 2 3 timing for transferring data from the uart2 reception shift register to the reception buffer. the rising edge of the final bit of the reception clock the falling edge of the final bit of the reception clock timing for generating a uart2 reception/ack interrupt request the rising edge of the final bit of the reception clock the falling edge of the final bit of the reception clock 4 3 to 6 cycles < duration for setting-up (note 2) 3 to 6 cycles < duration for holding (note 2) note 1 : when the start/stop condition control bit shtc is 1 . note 2 : cycles is in terms of the input oscillation frequency f(x in ) of the main clock. duration for setting up duration for holding scl sda (start condition) sda (stop condition) table 1.16.11. functions changed by i 2 c mode select bit 2 table 1.16.12. timing characteristics of detecting the start condition and the stop condition (note 1)
uart2 special mode register 2 128 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r p7 0 /txd 2 /sda p7 1 /rxd 2 /scl clk control p7 2 /clk 2 falling edge detection uart2 reception/ack interrupt request to dma0 to dma0 2 p7 0 through p7 2 conforming to the simplified i c bus i/o timer uart2 timer uart2 iicm=1 (sdds=0) or dl=000 (sdds=1) iicm=0 or iicm2=1 iicm=1 and iicm2=0 sdhi noize filter timer uart2 uart2 i/o d t q d t q d t q nack ack uart2 uart2 iicm=1 iicm=0 iicm=0 iicm=1 iicm=1 iicm=0 s r q iicm=1 iicm=0 i/o r q als iicm=0 or dl 000 (sdds=1) sdds=0 or dl=000 sdds=1 and dl 000 swc2 falling edge of 9 bit swc iicm=1 and iicm2=0 iicm=0 or iicm2=1 selector selector selector noize filter noize filter * with iicm set to 1, the port terminal is to be readable even if 1 is assigned to p7 1 of the direction register. port reading external clock internal clock 9th pulse bus collision detection bus collision/start, stop condition detection interrupt request uart2 transmission/ nack interrupt request start condition detection stop condition detection l-synchronous output enabling bit (port p7 1 output data latch) data bus reception register bus busy transmission register arbitration analog delay digital delay (divider) functions available in i 2 c mode are shown in figure 1.16.30 a functional block diagram. bit 3 of the uart2 special mode register 2 (address 0376 16 ) is used as the sda output stop bit. setting this bit to 1 causes an arbitration loss to occur, and the sda pin turns to high-impedance state at the instant when the arbitration lost detecting flag is set to 1. bit 1 of the uart2 special mode register 2 (address 0376 16 ) is used as the clock synchronization bit. with this bit set to 1 at the time when the internal scl is set to h, the internal scl turns to l if the falling edge is found in the scl pin; and the baud rate generator reloads the set value, and start counting within the l interval. when the internal scl changes from l to h with the scl pin set to l, stops counting the baud rate generator, and starts counting it again when the scl pin turns to h. due to this function, the uart2 transmission-reception clock becomes the logical product of the signal flowing through the internal scl and that flowing through the scl pin. this function operates over the period from the moment earlier by a half cycle than falling edge of the uart2 first clock to the rising edge of the ninth bit. to use this function, choose the internal clock for the transfer clock. bit 2 of the uart2 special mode register 2 (0376 16 ) is used as the scl wait output bit. setting this bit to 1 causes the scl pin to be fixed to l at the falling edge of the ninth bit of the clock. setting this bit to 0 frees the output fixed to l. figure 1.16.30. functional block diagram for i 2 c mode
uart2 special mode register 2 129 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r bit 4 of the uart2 special mode register 2 (address 0376 16 ) is used as the uart2 initialization bit. setting this bit to 1, and when the start condition is detected, the microcomputer operates as follows. (1) the transmission shift register is initialized, and the content of the transmission register is transferred to the transmission shift register. this starts transmission by dealing with the clock entered next as the first bit. the uart2 output value, however, doesnt change until the first bit data is output after the entrance of the clock, and remains unchanged from the value at the moment when the microcomputer detected the start condition. (2) the reception shift register is initialized, and the microcomputer starts reception by dealing with the clock entered next as the first bit. (3) the scl wait output bit turns to 1. this turns the scl pin to l at the falling edge of the ninth bit of the clock. starting to transmit/receive signals to/from uart2 using this function doesnt change the value of the transmission buffer empty flag. to use this function, choose the external clock for the transfer clock. bit 5 of the uart2 special mode register 2 (0376 16 ) is used as the scl wait output bit 2. setting this bit to 1 with the serial i/o specified allows the user to forcibly output an 1 from the scl pin even if uart2 is in operation. setting this bit to 0 frees the l output from the scl pin, and the uart2 clock is input/ output. bit 6 of the uart2 special mode register 2 (0376 16 ) is used as the sda output disable bit. setting this bit to 1 forces the sda pin to turn to the high-impedance state. refrain from changing the value of this bit at the rising edge of the uart2 transfer clock. there can be instances in which arbitration lost detecting flag is turned on.
a-d converter 130 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r item performance method of a-d conversion successive approximation (capacitive coupling amplifier) analog input voltage (note 1) 0v to av cc (v cc ) operating clock ad (note 2) v cc = 5v f ad /divide-by-2 of f ad /divide-by-4 of f ad , f ad =f(x in ) v cc = 3v divide-by-2 of f ad /divide-by-4 of f ad , f ad =f(x in ) resolution 8-bit or 10-bit (selectable) absolute precision v cc = 5v ? without sample and hold function 3lsb ? with sample and hold function (8-bit resolution) 2lsb ? with sample and hold function (10-bit resolution) an 0 to an 7 input : 3lsb anex0 and anex1 input (including mode in which external operation amp is connected) : 7lsb v cc = 3v ? without sample and hold function (8-bit resolution) 2lsb operating modes one-shot mode analog input pins 8pins (an 0 to an 7 ) + 2pins (anex0 and anex1) a-d conversion start condition ? software trigger a-d conversion starts when the a-d conversion start flag changes to 1 ? external trigger (can be retriggered) a-d conversion starts when the a-d conversion start flag is 1 and the ___________ ad trg /p9 7 input changes from h to l conversion speed per pin ? without sample and hold function 8-bit resolution: 49 ad cycles , 10-bit resolution: 59 ad cycles ? with sample and hold function 8-bit resolution: 28 ad cycles , 10-bit resolution: 33 ad cycles a-d converter the a-d converter consists of one 10-bit successive approximation a-d converter circuit with a capacitive coupling amplifier. pins p10 0 to p10 7 , p9 5 , and p9 6 also function as the analog signal input pins. the direction registers of these pins for a-d conversion must therefore be set to input. the vref connect bit (bit 5 at address 03d7 16 ) can be used to isolate the resistance ladder of the a-d converter from the reference voltage input pin (v ref ) when the a-d converter is not used. doing so stops any current flowing into the resistance ladder from v ref , reducing the power dissipation. when using the a-d converter, start a-d conversion only after setting bit 5 of 03d7 16 to connect v ref . the result of a-d conversion is stored in the a-d registers of the selected pins. when set to 10-bit precision, the low 8 bits are stored in the even addresses and the high 2 bits in the odd addresses. when set to 8-bit precision, the low 8 bits are stored in the even addresses. table 1.17.1 shows the performance of the a-d converter. figure 1.17.1 shows the block diagram of the a-d converter, and figures 1.17.2 and 1.17.3 show the a-d converter-related registers. note 1: does not depend on use of sample and hold function. note 2: divide the frequency if f(x in ) exceeds 10mh z , and make ad frequency equal to or less than 10mhz. without sample and hold function, set the ad frequency to 250kh z min. with the sample and hold function, set the ad frequency to 1mh z min. table 1.17.1. performance of a-d converter
a-d converter 131 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.17.1. block diagram of a-d converter 1/2 ad 1/2 f ad a-d conversion rate selection (03c1 16 , 03c0 16 ) (03c3 16 , 03c2 16 ) (03c5 16 , 03c4 16 ) (03c7 16 , 03c6 16 ) (03c9 16 , 03c8 16 ) (03cb 16 , 03ca 16 ) (03cd 16 , 03cc 16 ) (03cf 16 , 03ce 16 ) cks1=1 cks0=0 0 0 : normal operation 0 1 : anex0 1 0 : anex1 1 1 : external op-amp mode a-d register 0(16) a-d register 1(16) a-d register 2(16) a-d register 3(16) a-d register 4(16) a-d register 5(16) a-d register 6(16) a-d register 7(16) resistor ladder anex1 anex0 successive conversion register opa1,opa0=0,1 opa0=1 opa1=1 opa1,opa0=1,1 an 0 an 1 an 2 an 3 an 5 an 6 an 7 a-d control register 0 (address 03d6 16 ) a-d control register 1 (address 03d7 16 ) v ref v in data bus high-order data bus low-order v ref an 4 opa1,opa0=0,0 vcut=0 av ss vcut=1 cks0=1 cks1=0 ch2,ch1,ch0=000 ch2,ch1,ch0=001 ch2,ch1,ch0=010 ch2,ch1,ch0=011 ch2,ch1,ch0=100 ch2,ch1,ch0=101 ch2,ch1,ch0=110 ch2,ch1,ch0=111 decoder comparator opa1, opa0 addresses
a-d converter 132 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.17.2. a-d converter-related registers (1) a-d control register 0 (note) symbol address when reset adcon0 03d6 16 00000xxx 2 b7 b6 b5 b4 b3 b2 b1 b0 analog input pin select bit 0 0 0 : an 0 is selected 0 0 1 : an 1 is selected 0 1 0 : an 2 is selected 0 1 1 : an 3 is selected 1 0 0 : an 4 is selected 1 0 1 : an 5 is selected 1 1 0 : an 6 is selected 1 1 1 : an 7 is selected ch0 bit symbol bit name function ch1 ch2 a-d operation mode select bit 0 0 0 : one-shot mode must not be set except 00 md0 md1 trigger select bit 0 : software trigger 1 : ad trg trigger trg adst a-d conversion start flag 0 : a-d conversion disabled 1 : a-d conversion started frequency select bit 0 0 : f ad /4 is selected 1 : f ad /2 is selected cks0 w r a-d control register 1 (note) symbol address when reset adcon1 03d7 16 00 16 bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 w r b2 b1 b0 b4 b3 note: if the a-d control register is rewritten during a-d conversion, the conversion result is indeterminate. note: if the a-d control register is rewritten during a-d conversion, the conversion result is indeterminate. a a a a a a a a a a a a a a a a a a a a bits 8/10-bit mode select bit 0 : 8-bit mode 1 : 10-bit mode vcut opa0 vref connect bit opa1 0 : vref not connected 1 : vref connected external op-amp connection mode bit 0 0 : anex0 and anex1 are not used 0 1 : anex0 input is a-d converted 1 0 : anex1 input is a-d converted 1 1 : external op-amp connection mode b7 b6 frequency select bit 1 0 : f ad /2 or f ad /4 is selected 1 : f ad is selected cks1 a a a a a a a a a a reserved bit must always be set to 0 0 0 0
a-d converter 133 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.17.3. a-d converter-related registers (2) a-d control register 2 (note) symbol address when reset adcon2 03d4 16 0000xxx0 2 b7 b6 b5 b4 b3 b2 b1 b0 a-d conversion method select bit 0 : without sample and hold 1 : with sample and hold bit symbol bit name function r w note: if the a-d control register is rewritten during a-d conversion, the conversion result is indeterminate. a a a a nothing is assigned. in an attempt to write to these bits, write 0. the value, if read, turns out to be 0. a-d register i symbol address when reset adi(i=0 to 7) 03c0 16 to 03cf 16 indeterminate eight low-order bits of a-d conversion result function r w (b15) b7 b7 b0 b0 (b8) during 10-bit mode two high-order bits of a-d conversion result nothing is assigned. in an attempt to write to these bits, write 0. the value, if read, turns out to be 0. during 8-bit mode when read, the content is indeterminate a a a a smp reserved bit must always be set to 0 a a a a 000
a-d converter 134 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r (1) one-shot mode in one-shot mode, the pin selected using the analog input pin select bit is used for one-shot a-d conver- sion. table 1.17.2 shows the specifications of one-shot mode. figure 1.17.4 shows the a-d control regis- ter in one-shot mode. table 1.17.2. one-shot mode specifications figure 1.17.4. a-d conversion register in one-shot mode a-d control register 0 (note) symbol address when reset adcon0 03d6 16 00000xxx 2 b7 b6 b5 b4 b3 b2 b1 b0 analog input pin select bit bit symbol bit name function ch1 ch2 a-d operation mode select bit 0 md0 md1 trigger select bit 0 : software trigger 1 : ad trg trigger trg adst a-d conversion start flag 0 : a-d conversion disabled 1 : a-d conversion started frequency select bit 0 0: f ad /4 is selected 1: f ad /2 is selected cks0 w r 0 0 a-d control register 1 (note) symbol address when reset adcon1 03d7 16 00 16 bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 reserved bit must always be set to 0 w r 0 0 0 0 : an 0 is selected 0 0 1 : an 1 is selected 0 1 0 : an 2 is selected 0 1 1 : an 3 is selected 1 0 0 : an 4 is selected 1 0 1 : an 5 is selected 1 1 0 : an 6 is selected 1 1 1 : an 7 is selected b2 b1 b0 0 0 : one-shot mode b4 b3 ch0 1 note : if the a-d control register is rewritten during a-d conversion, the conversion result is indeterminate. note: if the a-d control register is rewritten during a-d conversion, the conversion result is indeterminate. a a a a a a a a a a a a a a a a a a a a a a bits 8/10-bit mode select bit 0 : 8-bit mode 1 : 10-bit mode vcut opa0 vref connect bit opa1 1 : vref connected external op-amp connection mode bit 0 0 : anex0 and anex1 are not used 0 1 : anex0 input is a-d converted 1 0 : anex1 input is a-d converted 1 1 : external op-amp connection mode b7 b6 frequency select bit1 0 : f ad /2 or f ad /4 is selected 1 : f ad is selected cks1 a a a a a a a a a a 00 item specification function the pin selected by the analog input pin select bit is used for one a-d conversion start condition writing 1 to a-d conversion start flag stop condition end of a-d conversion (a-d conversion start flag changes to 0, except when external trigger is selected) writing 0 to a-d conversion start flag interrupt request generation timing end of a-d conversion input pin one of an 0 to an 7 , as selected reading of result of a-d converter read a-d register corresponding to selected pin
a-d converter 135 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r (a) sample and hold sample and hold is selected by setting bit 0 of the a-d control register 2 (address 03d4 16 ) to 1. when sample and hold is selected, the rate of conversion of each pin increases. as a result, a 28 ad cycle is achieved with 8-bit resolution and 33 ad with 10-bit resolution. sample and hold can be selected in all modes. however, in all modes, be sure to specify before starting a-d conversion whether sample and hold is to be used. (b) extended analog input pins in one-shot mode and repeat mode, the input via the extended analog input pins anex0 and anex1 can also be converted from analog to digital. when bit 6 of the a-d control register 1 (address 03d7 16 ) is 1 and bit 7 is 0, input via anex0 is converted from analog to digital. the result of conversion is stored in a-d register 0. when bit 6 of the a-d control register 1 (address 03d7 16 ) is 0 and bit 7 is 1, input via anex1 is converted from analog to digital. the result of conversion is stored in a-d register 1. (c) external operation amp connection mode in this mode, multiple external analog inputs via the extended analog input pins, anex0 and anex1, can be amplified together by just one operation amp and used as the input for a-d conversion. when bit 6 of the a-d control register 1 (address 03d7 16 ) is 1 and bit 7 is 1, input via an 0 to an 7 is output from anex0. the input from anex1 is converted from analog to digital and the result stored in the corresponding a-d register. the speed of a-d conversion depends on the response of the external op- eration amp. do not connect the anex0 and anex1 pins directly. figure 1.17.5 is an example of how to connect the pins in external operation amp mode. analog input external o p -am p an 0 an 7 an 1 an 2 an 3 an 4 an 5 an 6 anex1 anex0 resistor ladder successive conversion register comparator figure 1.17.5. example of external op-amp connection mode
programmable i/o port 136 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r programmable i/o ports there are 87 programmable i/o ports: p0 to p10 (excluding p8 5 ). each port can be set independently for input or output using the direction register. a pull-up resistance for each block of 4 ports can be set. p8 5 is an input-only port and has no built-in pull-up resistance. figures 1.20.1 to 1.20.4 show the programmable i/o ports. figure 1.20.5 shows the i/o pins. each pin functions as a programmable i/o port and as the i/o for the built-in peripheral devices. to use the pins as the inputs for the built-in peripheral devices, set the direction register of each pin to input mode. when the pins are used as the outputs for the built-in peripheral devices (other than the d-a con- verter), they function as outputs regardless of the contents of the direction registers. when pins are to be used as the outputs for the d-a converter, do not set the direction registers to output mode. see the descriptions of the respective functions for how to set up the built-in peripheral devices. (1) direction registers figure 1.20.6 shows the direction registers. these registers are used to choose the direction of the programmable i/o ports. each bit in these regis- ters corresponds one for one to each i/o pin. in memory expansion and microprocessor mode, the contents of corresponding direction register of pins _______ _______ _____ ________ ______ ________ _______ _______ __________ _________ a 0 to a 19 , d 0 to d 15 , cs0 to cs3, rd, wrl/wr, wrh/bhe, ale, rdy, hold, hlda and bclk cannot be modified. note: there is no direction register bit for p8 5 . (2) port registers figure 1.20.7 shows the port registers. these registers are used to write and read data for input and output to and from an external device. a port register consists of a port latch to hold output data and a circuit to read the status of a pin. each bit in port registers corresponds one for one to each i/o pin. in memory expansion and microprocessor mode, the contents of corresponding port register of pins a 0 to _______ ________ _____ ________ ______ ________ ________ _______ __________ _________ a 19 , d 0 to d 15 , cs0 to cs3, rd, wrl/wr, wrh/bhe, ale, rdy, hold, hlda and bclk cannot be modified. (3) pull-up control registers figure 1.20.8 shows the pull-up control registers. the pull-up control register can be set to apply a pull-up resistance to each block of 4 ports. when ports are set to have a pull-up resistance, the pull-up resistance is connected only when the direction register is set for input. however, in memory expansion mode and microprocessor mode, the pull-up control register of p0 to p3, p4 0 to p4 3 , and p5 is invalid. the contents of register can be changed, but the pull-up resistance is not connected. (4) port control register figure 1.20.9 shows the port control register. the bit 0 of port control register is used to read port p1 as follows: 0 : when port p1 is input port, port input level is read. when port p1 is output port , the contents of port p1 register is read. 1 : the contents of port p1 register is read always. this register is valid in the following: ? external bus width is 8 bits in microprocessor mode or memory expansion mode. ? port p1 can be used as a port in multiplexed bus for the entire space.
programmable i/o port 137 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.20.1. programmable i/o ports (1) p0 0 to p0 7 , p2 0 to p2 7 , p3 0 to p3 7 , p4 0 to p4 7 , p5 0 to p5 4 , p5 6 p1 0 to p1 4 p1 5 to p1 7 p5 7 , p6 0 , p6 1 , p6 4 , p6 5 , p7 2 , p7 3 , p7 4 data bus direction register pull-up selection port latch data bus direction register pull-up selection port latch port p1 control register direction register port latch port p1 control register pull-up selection data bus input to respective peripheral functions direction register port latch pull-up selection data bus input to respective peripheral functions "1" output (note) (note) (note) (note) note: symbolizes a parasitic diode. do not apply a voltage higher than vcc to each port.
programmable i/o port 138 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.20.2. programmable i/o ports (2) p8 2 to p8 4 data bus direction register pull-up selection port latch input to respective peripheral functions (note1) p6 3 , p6 7 "1" output data bus direction register pull-up selection port latch (note1) p8 5 data bus nmi interrupt input (note1) data bus direction register pull-up selection port latch input to respective peripheral functions (note 2) (note1) p7 6 , p7 7 , p8 0 , p8 1 , p9 0 , p9 3 , p9 4 (inside dotted-line not included) p5 5 , p6 2 , p6 6 , p7 5 , p9 1 , p9 2 , p9 7 (inside dotted-line included) note 1: symbolizes a parasitic diode. do not apply a voltage higher than vcc to each port. note 2: in a part of port, the input to a respective peripheral functions does not exist, but schmitt circuit exists.
programmable i/o port 139 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.20.3. programmable i/o ports (3) note 1: symbolizes a parasitic diode. do not apply a voltage higher than vcc to each port. p9 6 , p10 0 to p10 3 (inside dotted-line not included) p9 5 , p10 4 to p10 7 (inside dotted-line included) data bus direction register pull-up selection port latch analog input input to respective peripheral functions (note 1) p7 0 , p7 1 "1" output direction register port latch input to respective peripheral functions (note 2) data bus note 2: symbolizes a parasitic diode.
programmable i/o port 140 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.20.5. i/o pins figure 1.20.4. programmable i/o ports (4) p8 7 p8 6 fc rf rd data bus direction register pull-up selection port latch "1" output direction register pull-up selection port latch data bus note : symbolizes a parasitic diode. do not apply a voltage higher than vcc to each port. (note) (note) byte byte signal input cnv ss cnv ss signal input reset reset signal input note : symbolizes a parasitic diode. do not apply a voltage higher than vcc to each pin. (note) (note) (note)
programmable i/o port 141 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.20.6. direction register port pi direction register (note 1, 2) symbol address when reset pdi (i = 0 to 10, except 8) 03e2 16 , 03e3 16 , 03e6 16 , 03e7 16 , 03ea 16 00 16 03eb 16 , 03ee 16 , 03ef 16 , 03f3 16 , 03f6 16 00 16 bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 pdi_0 port pi 0 direction register pdi_1 port pi 1 direction register pdi_2 port pi 2 direction register pdi_3 port pi 3 direction register pdi_4 port pi 4 direction register pdi_5 port pi 5 direction register pdi_6 port pi 6 direction register pdi_7 port pi 7 direction register 0 : input mode (functions as an input port) 1 : output mode (functions as an output port) (i = 0 to 10 except 8) port p8 direction register symbol address when reset pd8 03f2 16 00x00000 2 bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 pd8_0 port p8 0 direction register pd8_1 port p8 1 direction register pd8_2 port p8 2 direction register pd8_3 port p8 3 direction register pd8_4 port p8 4 direction register nothing is assigned. in an attempt to write to this bit, write 0. the value, if read, turns out to be indeterminate. pd8_6 port p8 6 direction register pd8_7 port p8 7 direction register 0 : input mode (functions as an input port) 1 : output mode (functions as an output port) 0 : input mode (functions as an input port) 1 : output mode (functions as an output port) a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a note 2: in memory expansion and microprocessor mode, the contents of corresponding port pi direction register of pins a 0 to a 19 , d 0 to d 15 , cs 0 to cs 3 , rd, wrl/wr, wrh/bhe, ale, rdy, hold, hlda and bclk cannot be modified. note 1: set bit 2 of protect register (address 000a 16 ) to 1 before rewriting to the port p9 direction register.
programmable i/o port 142 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r port pi register (note 2) symbol address when reset pi (i = 0 to 10, except 8) 03e0 16 , 03e1 16 , 03e4 16 , 03e5 16 , 03e8 16 indeterminate 03e9 16 , 03ec 16 , 03ed 16 , 03f1 16 , 03f4 16 indeterminate bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 pi_0 port pi 0 register pi_1 port pi 1 register pi_2 port pi 2 register pi_3 port pi 3 register pi_4 port pi 4 register pi_5 port pi 5 register pi_6 port pi 6 register pi_7 port pi 7 register data is input and output to and from each pin by reading and writing to and from each corresponding bit 0 : l level data 1 : h level data (note 1) (i = 0 to 10 except 8) port p8 register symbol address when reset p8 03f0 16 indeterminate bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 p8_0 port p8 0 register p8_1 port p8 1 register p8_2 port p8 2 register p8_3 port p8 3 register p8_4 port p8 4 register p8_5 port p8 5 register p8_6 port p8 6 register p8_7 port p8 7 register data is input and output to and from each pin by reading and writing to and from each corresponding bit (except for p8 5 ) 0 : l level data 1 : h level data aa aa a a aa a aa a aa a aa a aa aa a a aa aa a a aa a aa aa a a aa a aa a aa a aa a aa a aa aa a a aa a aa a aa note 1: since p7 0 and p7 1 are n-channel open drain ports, the data is high-impedance. note 2: in memory expansion and microprocessor mode, the contents of corresponding port pi register of pins a 0 to a 19 , d 0 to d 15 , cs 0 to cs 3 , rd, wrl/wr, wrh/bhe, ale, rdy, hold, hlda and bclk cannot be modified. figure 1.20.7. port register
programmable i/o port 143 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.20.8. pull-up control register pull-up control register 0 (note) symbol address when reset pur0 03fc 16 00 16 bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 pu00 p0 0 to p0 3 pull-up pu01 p0 4 to p0 7 pull-up pu02 p1 0 to p1 3 pull-up pu03 p1 4 to p1 7 pull-up pu04 p2 0 to p2 3 pull-up pu05 p2 4 to p2 7 pull-up pu06 p3 0 to p3 3 pull-up pu07 p3 4 to p3 7 pull-up the corresponding port is pulled high with a pull-up resistor 0 : not pulled high 1 : pulled high a a a a a a a a a a a a a a a a a a a a pull-up control register 1 symbol address when reset pur1 03fd 16 00 16 (note 2) bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 pu10 p4 0 to p4 3 pull-up (note 3) pu11 p4 4 to p4 7 pull-up pu12 p5 0 to p5 3 pull-up (note 3) pu13 p5 4 to p5 7 pull-up (note 3) pu14 p6 0 to p6 3 pull-up pu15 p6 4 to p6 7 pull-up pu16 p7 2 to p7 3 pull-up (note 1) pu17 p7 4 to p7 7 pull-up the corresponding port is pulled high with a pull-up resistor 0 : not pulled high 1 : pulled high note 1: since p7 0 and p7 1 are n-channel open drain ports, pull-up is not available for them. note 2: when the v cc level is being impressed to the cnv ss terminal, this register becomes to 02 16 when reset (pu11 becomes to 1). a a a a a a a a a a a a a a a a a a a a a a pull-up control register 2 symbol address when reset pur2 03fe 16 00 16 bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 pu20 p8 0 to p8 3 pull-up pu21 p8 4 to p8 7 pull-up (except p8 5 ) pu22 p9 0 to p9 3 pull-up pu23 p9 4 to p9 7 pull-up pu24 p10 0 to p10 3 pull-up pu25 p10 4 to p10 7 pull-up nothing is assigned. in an attempt to write to these bits, write 0. the value, if read, turns out to be 0. the corresponding port is pulled high with a pull-up resistor 0 : not pulled high 1 : pulled high a a a a a a a a a a a a a a a a a a note 3: in memory expansion and microprocessor mode, the content of these bits can be changed, but the pull-up resistance is not connected. note : in memory expansion and microprocessor mode, the content of this register can be changed, but the pull-up resistance is not connected.
programmable i/o port 144 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r figure 1.20.9. port control register port control register symbpl address when reset pcr 03ff 16 00 16 bit name function bit symbol w r b7 b6 b5 b4 b3 b2 b1 b0 pcr0 port p1 control register 0 : when input port, read port input level. when output port, read the contents of port p1 register. 1 : read the contents of port p1 register though input/output port. nothing is assigned. in an attempt to write to these bits, write 0. the value, if read, turns out to be 0. a a
programmable i/o port 145 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r pin name connection ports p0 to p10 (excluding p8 5 ) x out (note) av ss , v ref , byte av cc after setting for input mode, connect every pin to v ss via a resistor (pull-down); or after setting for output mode, leave these pins open. open connect to v cc connect to v ss note: with external clock input to x in pin. nmi connect via resistor to v cc (pull-up) table 1.20.1. example connection of unused pins in single-chip mode pin name connection ports p6 to p10 (excluding p8 5 ) av ss , v ref av cc after setting for input mode, connect every pin to v ss via a resistor (pull-down); or after setting for output mode, leave these pins open. open connect to v cc connect to v ss note 1: with external clock input to x in pin. note 2: when the bclk output disable bit (bit 7 at address 0004 16 ) is set to 1, connect to v cc via a resistor (pull-up). hold, rdy, nmi connect via resistor to v cc (pull-up) bhe, ale, hlda, x out (note 1), bclk (note 2) p4 5 / cs1 to p4 7 / cs3 set ports to input mode, set output enable bits of cs1 through cs3 to 0, and connect to vcc via resistors (pull-up). figure 1.20.10. example connection of unused pins port p0 to p10 (except for p8 5 ) (input mode) (input mode) (output mode) nmi x out av cc byte av ss v ref microcomputer v cc v ss in single-chip mode port p6 to p10 (except for p8 5 ) (input mode) (input mode) (output mode) nmi x out av cc av ss v ref open microcomputer v cc v ss in memory expansion mode or in microprocessor mode hold rdy ale bclk (note) bhe hlda open open open port p4 5 / cs1 to p4 7 / cs3 note : when the bclk output disable bit (bit 7 at address 0004 16 ) is set to 1, connect to v cc via a resistor (pull-up). table 1.20.2. example connection of unused pins in memory expansion mode and microprocessor mode
electrical characteristics 146 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r table 1.23.1. absolute maximum ratings note : specify a product of -40 c to 85 c to use it. v ref , x in x out v o -0.3 to vcc+0.3 -0.3 to vcc+0.3 p d topr=25 -0.3 to 6.5 -0.3 to 6.5 v v v v i avcc vcc t stg t opr mw v -65 to 150 300 -20 to 85 / -40 to 85 (note) p3 0 to p3 7 , p4 0 to p4 7 , p5 0 to p5 7 , p6 0 to p6 7 , p7 2 to p7 7 , p8 0 to p8 7 , p0 0 to p0 7 , p1 0 to p1 7 , p2 0 to p2 7 , p3 0 to p3 7 ,p4 0 to p4 7 , p5 0 to p5 7 , p6 0 to p6 7 ,p7 2 to p7 7 , p8 0 to p8 4, p0 0 to p0 7 , p1 0 to p1 7 , p2 0 to p2 7 , reset, p9 0 to p9 7 , p10 0 to p10 7 , p8 6 , p8 7 , p9 0 to p9 7 , p10 0 to p10 7 , p7 0 , p7 1 p7 0 , p7 1 -0.3 to 6.5 -0.3 to 6.5 v v cnv ss , byte, v cc =av cc v cc =av cc c c c symbol parameter condition rated value unit supply voltage analog supply voltage input voltage output voltage power dissipation operating ambient temperature storage temperature electrical characteristics
electrical characteristics 147 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r note 1: the mean output current is the mean value within 100ms. note 2: the total i ol (peak) for ports p0, p1, p2, p8 6 , p8 7 , p9, and p10 must be 80ma max. the total i oh (peak) for ports p0, p1, p2, p8 6 , p8 7 , p9, and p10 must be 80ma max. the total i ol (peak) for ports p3, p4, p5, p6, p7, and p8 0 to p8 4 must be 80ma max. the total i oh (peak) for ports p3, p4, p5, p6, p7 2 to p7 7 , and p8 0 to p8 4 must be 80ma max. note 3: specify a product of -40 c to 85 c to use it. note 4: relationship between main clock oscillation frequency and supply voltage. table 1.23.2. recommended operating conditions (referenced to v cc = 2.7v to 5.5v at topr = 20 o c to 85 o c / 40 o c to 85 o c (note 3) unless otherwise specified) main clock input oscillation frequency (no wait) aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa 16.0 5.0 0.0 2.7 4.2 5.5 operating maximum frequency [mh z ] supply voltage [v] (bclk: no division) 7.33 x v cc - 14.791mh z main clock input oscillation frequency (with wait) aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa 16.0 10.0 0.0 2.7 4.2 5.5 operating maximum frequency [mh z ] supply voltage [v] (bclk: no division) 4 x v cc - 0.8mh z 2.7 5.5 vcc 5.0 vcc avcc v v 0 0 v ih i oh (avg) ma ma vss avss 0.8vcc v v v v v v v 0.8vcc 0.5vcc vcc vcc vcc 0.2vcc 0.2vcc 0 0 0 (data input function during memory expansion and microprocessor modes) 0.16vcc i oh (peak) p7 2 to p7 7 , p8 0 to p8 7 , p9 0 to p9 7 , p10 0 to p10 7 , -5.0 -10.0 p0 0 to p0 7 , p1 0 to p1 7 , p2 0 to p2 7 , p3 0 (during single-chip mode) p0 0 to p0 7 , p1 0 to p1 7 , p2 0 to p2 7 , p3 0 p0 0 to p0 7 , p1 0 to p1 7 , p2 0 to p2 7 , p3 0 to p3 7 , p4 0 to p4 7 , p5 0 to p5 7 , p6 0 to p6 7 , p7 2 to p7 7 , p8 0 to p8 4 , p8 6 , p8 7 , p9 0 to p9 7 , p10 0 to p10 7 p3 1 to p3 7 , p4 0 to p4 7 , p5 0 to p5 7, p6 0 to p6 7 , 10.0 5.0 ma f (x in ) i ol (peak) ma i ol (avg) f (xc in ) khz 50 32.768 v x in , reset, cnv ss , byte p7 0 to p7 7 , p8 0 to p8 7 , p9 0 to p9 7 , p10 0 to p10 7 , p3 1 to p3 7 , p4 0 to p4 7 , p5 0 to p5 7, p6 0 to p6 7 , x in , reset, cnv ss , byte (data input function during memory expansion and microprocessor modes) p0 0 to p0 7 , p1 0 to p1 7 , p2 0 to p2 7 , p3 0 (during single-chip mode) p0 0 to p0 7 , p1 0 to p1 7 , p2 0 to p2 7 , p3 0 p0 0 to p0 7 , p1 0 to p1 7 , p2 0 to p2 7 , p3 0 to p3 7 , p4 0 to p4 7 , p5 0 to p5 7 , p6 0 to p6 7 , p7 2 to p7 7 , p8 0 to p8 4 , p8 6 , p8 7 , p9 0 to p9 7 , p10 0 to p10 7 p0 0 to p0 7 , p1 0 to p1 7 , p2 0 to p2 7 , p3 0 to p3 7 , p4 0 to p4 7 , p5 0 to p5 7 , p6 0 to p6 7 , p7 0 to p7 7 , p8 0 to p8 4 , p8 6 , p8 7 , p9 0 to p9 7 , p10 0 to p10 7 p0 0 to p0 7 , p1 0 to p1 7 , p2 0 to p2 7 , p3 0 to p3 7 , p4 0 to p4 7 , p5 0 to p5 7 , p6 0 to p6 7 , p7 0 to p7 7 , p8 0 to p8 4 , p8 6 , p8 7 , p9 0 to p9 7 , p10 0 to p10 7 p7 0 , 0.8vcc 6.5 v p7 1 v il 7.33 x vcc -14.791 4 x vcc -0.8 vcc=4.2v to 5.5v vcc=2.7v to 4.2v vcc=4.2v to 5.5v vcc=2.7v to 4.2v 0 0 0 0 mhz mhz mhz mhz 16 16 symbol parameter unit standard min typ. max. supply voltage analog supply voltage supply voltage analog supply voltage high input voltage low input voltage high peak output current high average output current low peak output current low average output current main clock input oscillation frequency (note 4) subclock oscillation frequency with wait no wait
electrical characteristics 148 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r table 1.23.3. a-d conversion characteristics (referenced to v cc = av cc = v ref = 2.7v to 5.5v, vss = av ss = 0v at topr = 20 o c to 85 o c / 40 o c to 85 o c (note 4) unless otherwise specified) s standard min. typ. max. resolution absolute accuracy bits lsb v ref = v cc 3 10 symbol parameter measuring condition unit v ref = v cc = 5v r ladder t conv ladder resistance conversion time(10bit), sample & hold function available reference voltage analog input voltage k ? v v ia v ref v 0 2.7 10 v cc v ref 40 3.3 2.8 t conv t samp sampling time 0.3 v ref = v cc sample & hold function not available sample & hold function available(10bit) an 0 to an 7 input anex0, anex1 input, external op-amp connection mode v ref =v cc = 5v lsb lsb 7 sample & hold function available(8bit) v ref = v cc = 5v 2 lsb s s 3 note 1: do f(x in ) in range of main clock input oscillation frequency prescribed with recommended operating conditions of table 1.23.2. divide the f ad if f(x in ) exceeds 10mhz, and make ad operation clock frequency (?ad) equal to or lower than 10mhz. and divide the f ad if v cc is less than 4.2v, and make ad operation clock frequency (?ad) equal to or lower than f ad /2. note 2: a case without sample & hold function turn ad operation clock frequency (?ad) into 250 khz or more in addition to a limit of note 1. a case with sample & hold function turn ad operation clock frequency (?ad) into 1mhz or more in addition to a limit of note 1. note 3: connect av cc pin to v cc pin and apply the same electric potential. note 4: specify a product of -40c to 85c to use it. sample & hold function not available(8bit) v ref = v cc = 3v, ? ad = f ad /2 2 lsb conversion time(8bit), sample & hold function available v ref = v cc = 5v, ? ad =10mhz v ref = v cc = 5v, ? ad =10mhz 9.8 t conv s conversion time(8bit), sample & hold function not available v ref = v cc = 3v, ? ad = f ad /2 = 5mhz
electrical characteristics (vcc = 5v) 149 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r v cc = 5v table 1.23.6. electrical characteristics (referenced to v cc = 4.2v to 5.5v, v ss = 0v at topr = 20 o c to 85 o c / 40 o c to 85 o c (note 2) , f(x in ) = 16mh z unless otherwise specified) v oh v oh v oh v ol v ol v ol v v 4 . 7 v x o u t 3 . 0 3 . 0 v 2.0 0 . 4 5v v x out 2.0 2.0 3 . 0 i oh = -5ma, v cc =5.0v i oh = -1ma, v cc =5.0v i oh = -200 a, v cc =5.0v i oh = -0.5ma, v cc =5.0v i ol = 5ma, v cc =5.0v i ol = 1ma, v cc =5.0v i ol = 200 a, v cc =5.0v i ol = 0.5ma, v cc =5.0v p0 0 to p0 7 , p1 0 to p1 7 , p2 0 to p2 7 , p 0 0 t o p 0 7 , p 1 0 t o p 1 7 , p 2 0 t o p 2 7 , p3 0 to p3 7 , p4 0 to p4 7 , p5 0 to p5 7 , p3 0 to p3 7 , p4 0 to p4 7 , p5 0 to p5 7 , p6 0 to p6 7 , p7 2 to p7 7 , p8 0 to p8 4 , p0 0 to p0 7 , p1 0 to p1 7 , p2 0 to p2 7 , p3 0 to p3 7 , p4 0 to p4 7 , p5 0 to p5 7 , p6 0 to p6 7 , p7 2 to p7 7 , p8 0 to p8 4 , highpower lowpower p8 6 , p8 7 , p9 0 to p9 7 , p10 0 to p10 7 h i g h p o w e r lowpower p6 0 to p6 7 , p7 0 to p7 7 , p8 0 to p8 4 , p8 6 , p8 7 , p9 0 to p9 7 , p10 0 to p10 7 p8 6 , p8 7 , p9 0 to p9 7 , p10 0 to p10 7 highpower lowpower x c o u t 3 . 0 1.6 v p0 0 to p0 7 , p1 0 to p1 7 , p2 0 to p2 7 , p 3 0 t o p 3 7 , p 4 0 t o p 4 7 , p 5 0 t o p 5 7 , p 6 0 t o p 6 7 , p 7 0 t o p 7 7 , p 8 0 t o p 8 4 , p8 6 , p8 7 , p9 0 to p9 7 , p10 0 to p10 7 v t+- v t- 0 . 21. 0v v x cout 0 0 h i g h p o w e r lowpower s y m b o lp a r a m e t e r u n i t s t a n d a r d m i nt y p .m a x . h i g h o u t p u t v o l t a g e high output voltage high output voltage high output voltage l o w o u t p u t v o l t a g e l o w o u t p u t v o l t a g e l o w o u t p u t v o l t a g e l o w o u t p u t v o l t a g e h y s t e r e s i s w i t h n o l o a d a p p l i e d , v c c = 5 . 0 v w i t h n o l o a d a p p l i e d , v c c = 5 . 0 v with no load applied, v cc =5.0v w i t h n o l o a d a p p l i e d , v c c = 5 . 0 v i ih i i l v ram i c c v t+- v t- 0.2 1.8 v 5 . 0 a 2 . 0v m a reset p 0 0 t o p 0 7 , p 1 0 t o p 1 7 , p 2 0 t o p 2 7 , p 3 0 t o p 3 7 , p 4 0 t o p 4 7 , p 5 0 t o p 5 7 , p 6 0 t o p 6 7 , p 7 0 t o p 7 7 , p 8 0 t o p 8 7 , p 9 0 t o p 9 7 , p 1 0 0 t o p 1 0 7 , x i n , r e s e t , c n v s s , b y t e v i = 5v, v cc =5.0v v i = 0v, v cc =5.0v -5.0 3 0 . 05 0 . 0 f ( x i n ) = 1 6 m h z p 0 0 t o p 0 7 , p 1 0 t o p 1 7 , p 2 0 t o p 2 7 , p 3 0 t o p 3 7 , p 4 0 t o p 4 7 , p 5 0 t o p 5 7 , p 6 0 t o p 6 7 , p 7 0 t o p 7 7 , p 8 0 t o p 8 7 , p 9 0 t o p 9 7 , p 1 0 0 t o p 1 0 7 , x i n , r e s e t , c n v s s , b y t e f ( x c i n ) = 3 2 k h z r fxin r fxcin x in x cin 6.0 1.0 r p u l l u p 5 0 . 0 p0 0 to p0 7 , p1 0 to p1 7 , p2 0 to p2 7 , p3 0 to p3 7 , p4 0 to p4 7 , p5 0 to p5 7 , p6 0 to p6 7 , p7 2 to p7 7 , p8 0 to p8 4 , p8 6 , p8 7 , p9 0 to p9 7 , p10 0 to p10 7 v i = 0v, v cc =5.0v 30.0 167.0 h y s t e r e s i s h i g h i n p u t c u r r e n t l o w i n p u t c u r r e n t pull-up resistance feedback resistance f e e d b a c k r e s i s t a n c e ram retention voltage p o w e r s u p p l y c u r r e n t a when clock is stopped in single-chip mode, the output pins are open and other pins are v ss s quare wave, no di v i s i on s q u a r e w a v e measuring condition k ? m ? m ? a 90.0 clk 0 to clk 4 ,ta2 out , tb1 in , tb2 in , int 0 to int 2 , nmi, a d t r g , c t s 0 t o c t s 2 , s c l , s d a , hold, rdy, ta0 in to ta2 in , ki 0 to ki 3 , rxd 0 to rxd 2 1 . 0 a 20.0 4 . 0 a f ( x c i n ) = 3 2 k h z t o p r = 8 5 c w h e n c l o c k i s s t o p p e d topr = 25 c when clock is stopped w h e n a w a i t i n s t r u c t i o n i s e x e c u t e d ( n o t e 1 ) n o t e 1 : w i t h o n e t i m e r o p e r a t e d u s i n g f c 3 2 . n o t e 2 : s p e c i f y a p r o d u c t o f - 4 0 c t o 8 5 c t o u s e i t . 1 0 (topr = 25 c) v cc =5.0v v c c = 5 . 0 v
electrical characteristics (vcc = 5v) 150 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r timing requirements (referenced to v cc = 5v, v ss = 0v at topr = 20 o c to 85 o c / 40 o c to 85 o c (*) unless otherwise specified) * : specify a product of -40 c to 85 c to use it. f(bclk) x 2 (note) (note) (note) 40 30 0 0 40 0 note: calculated according to the bclk frequency as follows: 40 max. external clock rise time ns t r min. external clock input cycle time external clock input high pulse width external clock input low pulse width external clock fall time ns ns ns ns t c t w(h ) t w(l) t f parameter symbol unit standard 15 62.5 25 25 15 min. data input setup time ns t su(db-rd) t su(rdy-bclk ) parameter symbol unit max. standard ns rdy input setup time data input hold time ns t h(rd-db) t h(bclk -rdy) ns rdy input hold time ns hold input setup time t su(hold-bclk ) ns hold input hold time t h(bclk-hold ) data input access time (no wait) ns t ac1(rd-db) ns ns t ac2(rd-db) t ac3(rd-db) data input access time (with wait) data input access time (when accessing multiplex bus area) ns t d(bclk-hlda ) hlda output delay time t ac1(rd C db) = f(bclk) x 2 C 45 10 9 [ns] t ac2(rd C db) = f(bclk) x 2 C 45 3 x 10 9 [ns] t ac3(rd C db) = C 45 3 x 10 9 [ns] v cc = 5v table 1.23.8. memory expansion and microprocessor modes table 1.23.7. external clock input
electrical characteristics (vcc = 5v) 151 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r standard max. ns tai in input low pulse width t w(tal) min. ns ns unit standard max. min. ns ns ns unit standard max. min. ns ns ns unit standard max. min. ns ns unit standard max. min. ns ns ns unit ns ns tai in input high pulse width t w(tah) parameter symbol tai in input cycle time tai in input high pulse width tai in input low pulse width t c(ta) t w(tah) t w(tal) symbol parameter tai in input cycle time tai in input high pulse width tai in input low pulse width t c(ta) t w(tah) t w(tal) symbol parameter t w(tah) t w(tal) symbol parameter tai in input high pulse width tai in input low pulse width symbol parameter t c(ta) tai in input cycle time tai out input cycle time tai out input high pulse width tai out input low pulse width tai out input setup time tai out input hold time t c(up) t w(uph) t w(upl) t su(up-t in ) t h(t in- up) 40 100 40 400 200 200 200 100 100 100 100 2000 1000 1000 400 400 timing requirements (referenced to v cc = 5v, v ss = 0v at topr = 20 o c to 85 o c / 40 o c to 85 o c (*) unless otherwise specified) * : specify a product of -40 c to 85 c to use it. table 1.23.10. timer a input (gating input in timer mode) table 1.23.11. timer a input (external trigger input in one-shot timer mode) table 1.23.12. timer a input (external trigger input in pulse width modulation mode) table 1.23.13. timer a input (up/down input in event counter mode) v cc = 5v table 1.23.9. timer a input (counter input in event counter mode)
electrical characteristics (vcc = 5v) 152 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r timing requirements (referenced to v cc = 5v, v ss = 0v at topr = 20 o c to 85 o c / 40 o c to 85 o c (*) unless otherwise specified) * : specify a product of -40 c to 85 c to use it. ns ns ns ns ns ns ns standard max. min. tbi in input cycle time (counted on one edge) tbi in input high pulse width (counted on one edge) tbi in input low pulse width (counted on one edge) ns ns ns t c(tb) t w(tbh) t w(tbl) parameter symbol unit t c(tb) t w(tbl) t w(tbh) ns ns ns tbi in input high pulse width (counted on both edges) tbi in input low pulse width (counted on both edges) tbi in input cycle time (counted on both edges) standard max. min. ns ns t c(tb) t w(tbh) symbol parameter unit t w(tbl) ns tbi in input high pulse width tbi in input cycle time tbi in input low pulse width standard max. min. ns ns t c(tb) symbol parameter unit t w(tbl) ns t w(tbh) tbi in input cycle time tbi in input high pulse width tbi in input low pulse width standard max. min. ns ns t c(ad) t w(adl) symbol parameter unit ad trg input cycle time (trigger able minimum) ad trg input low pulse width standard max. min. ns ns t w(inh) t w(inl) symbol parameter unit inti input low pulse width inti input high pulse width standard max. min. clki input cycle time clki input high pulse width clki input low pulse width t c(ck) t w(ckh) t w(ckl) parameter symbol unit t d(c-q) t su(d-c) t h(c-q) txdi hold time rxdi input setup time txdi output delay time t h(c-d) rxdi input hold time 100 40 40 80 80 200 400 200 200 400 200 200 1000 125 250 250 200 100 100 0 30 90 80 v cc = 5v table 1.23.17. a-d trigger input _______ table 1.23.19. external interrupt inti inputs table 1.23.15. timer b input (pulse period measurement mode) table 1.23.16. timer b input (pulse width measurement mode) table 1.23.18. serial i/o table 1.23.14. timer b input (counter input in event counter mode)
electrical characteristics (vcc = 5v) 153 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r symbol standard measuring condition max. min. parameter unit t d(bclk-ad) address output delay time 25 ns t h(bclk-ad) address output hold time (bclk standard) 4 ns t h(bclk-cs) chip select output hold time (bclk standard) 4 ns t d(bclk-ale) ale signal output delay time 25 ns t h(bclk-ale) ale signal output hold time C 4 ns t d(bclk-rd) rd signal output delay time 25 ns t h(bclk-rd) rd signal output hold time 0 ns t d(bclk-wr) wr signal output delay time 25 ns t h(bclk-wr) wr signal output hold time 0 ns t d(bclk-db) data output delay time (bclk standard) 40 ns t h(bclk-db) data output hold time (bclk standard) 4 ns t h(wr-db) data output hold time (wr standard)(note2) 0 ns t d(db-wr) data output delay time (wr standard) ns (note1) note 1: calculated according to the bclk frequency as follows: td(db C wr) = f(bclk) x 2 10 9 C 40 [ns] t d(bclk-cs) chip select output delay time 25 ns t h(rd-ad) address output hold time (rd standard) 0 ns t h(wr-ad) address output hold time (wr standard) 0 ns note 2: this is standard value shows the timing when the output is off, and doesn't show hold time of data bus. hold time of data bus is different by capacitor volume and pull-up (pull-down) resistance value. hold time of data bus is expressed in t = Ccr x ln (1 C v ol / v cc ) by a circuit of the right figure. for example, when v ol = 0.2v cc , c = 30pf, r = 1k ? , hold time of output l level is t = C 30pf x 1k ? x ln (1 C 0.2v cc / v cc ) = 6.7ns. dbi r c note 3: specify a product of -40c to 85c to use it. switching characteristics (referenced to v cc = 5v, v ss = 0v at topr = 20 o c to 85 o c / 40 o c to 85 o c (note 3), cm15 = 1 unless otherwise specified) v cc = 5v figure 1.23.1 table 1.23.20. memory expansion mode and microprocessor mode (no wait) figure 1.23.1. port p0 to p10 measurement circuit p6 p7 p8 p10 p9 p0 p1 p2 p3 p4 p5 30pf
electrical characteristics (vcc = 5v) 154 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r switching characteristics (referenced to v cc = 5v, v ss = 0v at topr = 20 o c to 85 o c / 40 o c to 85 o c (note 3), cm15 = 1 unless otherwise specified) v cc = 5v figure 1.23.1 table 1.23.21. memory expansion mode and microprocessor mode (with wait, accessing external memory) symbol standard measuring condition max. min. parameter unit t d(bclk-ad) address output delay time 25 ns t h(bclk-ad) address output hold time (bclk standard) 4 ns t h(bclk-cs) chip select output hold time (bclk standard) 4 ns t d(bclk-ale) ale signal output delay time 25 ns t h(bclk-ale) ale signal output hold time C 4 ns t d(bclk-rd) rd signal output delay time 25 ns t h(bclk-rd) rd signal output hold time 0 ns t d(bclk-wr) wr signal output delay time 25 ns t h(bclk-wr) wr signal output hold time 0 ns t d(bclk-db) data output delay time (bclk standard) 40 ns t h(bclk-db) data output hold time (bclk standard) 4 ns t h(wr-db) data output hold time (wr standard)(note2) 0 ns t d(db-wr) data output delay time (wr standard) ns (note1) note 1: calculated according to the bclk frequency as follows: td(db C wr) = f(bclk) 10 9 C 40 [ns] t d(bclk-cs) chip select output delay time 25 ns t h(rd-ad) address output hold time (rd standard) 0 ns t h(wr-ad) address output hold time (wr standard) 0 ns note 2: this is standard value shows the timing when the output is off, and doesn't show hold time of data bus. hold time of data bus is different by capacitor volume and pull-up (pull-down) resistance value. hold time of data bus is expressed in t = Ccr x ln (1 C v ol / v cc ) by a circuit of the right figure. for example, when v ol = 0.2v cc , c = 30pf, r = 1k ? , hold time of output l level is t = C 30pf x 1k ? x ln (1 C 0.2v cc / v cc ) = 6.7ns. dbi r c note 3: specify a product of -40c to 85c to use it.
electrical characteristics (vcc = 5v) 155 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r switching characteristics (referenced to v cc = 5v, v ss = 0v at topr = 20 o c to 85 o c / 40 o c to 85 o c (note 2), cm15 = 1 unless otherwise specified) v cc = 5v table 1.23.22. memory expansion mode and microprocessor mode (with wait, accessing external memory, multiplex bus area selected) symbol standard measuring condition max. min. parameter unit t d(bclk-ad) address output delay time 25 ns t h(bclk-ad) address output hold time (bclk standard) 4 ns t d(bclk-cs) chip select output delay time 25 ns t h(bclk-cs) chip select output hold time (bclk standard) 4 ns ns t h(rd-ad) address output hold time (rd standard) (note1) t d(bclk-rd) rd signal output delay time 25 ns t h(bclk-rd) rd signal output hold time 0 ns ns t h(wr-ad) address output hold time (wr standard) (note1) t d(bclk-wr) wr signal output delay time 25 ns t d(bclk-db) data output delay time (bclk standard) 40 ns t h(bclk-db) data output hold time (bclk standard) 4 ns t d(db-wr) data output delay time (wr standard) (note1) ns t d(bclk-ale) ale signal output delay time (bclk standard) 25 ns t h(bclk-ale) ale signal output hold time (bclk standard) C 4 ns t h(ale-ad) ale signal output hold time (adderss standard) 30 ns t h(bclk-wr) wr signal output hold time 0 ns ns t h(rd-cs) chip select output hold time (rd standard) (note1) t h(wr-cs) chip select output hold time (wr standard) (note1) ns t d(ad-rd) post-address rd signal output delay time ns 0 t d(ad-wr) post-address wr signal output delay time ns 0 t dz(rd-ad) address output floating start time ns 8 t h(wr-db) data output hold time (wr standard) ns (note1) note 1: calculated according to the bclk frequency as follows: th(rd C ad) = f(bclk) x 2 10 9 [ns] th(wr C ad) = f(bclk) x 2 10 9 [ns] th(rd C cs) = f(bclk) x 2 10 9 [ns] th(wr C cs) = f(bclk) x 2 10 9 [ns] td(db C wr) = f(bclk) x 2 10 9 C 40 [ns] x 3 td(ad C ale) = f(bclk) x 2 10 9 C 25 [ns] th(wr C db) = f(bclk) x 2 10 9 [ns] t d(ad-ale) ale signal output delay time (address standard) ns (note1) note 2: specify a product of -40c to 85c to use it. figure 1.23.1
timing (vcc = 5v) 156 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r v cc = 5v t su(dCc) tai in input tai out input during event counter mode tbi in input clki txdi rxdi t c(ta) t w(tah) t w(tal) t c(up) t w(uph) t w(upl) t c(tb) t w(tbh) t w(tbl) t c(ad) t w(adl) t c(ck) t w(ckh) t w(ckl) t w(inl) t w(inh) t d(cCq) t h(cCd) t h(cCq) t h(t in Cup) t su(upCt in ) tai in input (when count on falling edge is selected) tai in input (when count on rising edge is selected) tai out input (up/down input) inti input ad trg input figure 1.23.2. v cc = 5v timing diagram (1)
timing (vcc = 5v) 157 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r v cc = 5v measuring conditions : ? v cc =5v ? input timing voltage : determined with v il =1.0v, v ih =4.0v ? output timing voltage : determined with v ol =2.5v, v oh =2.5v memory expansion mode and microprocessor mode bclk hold input hlda output p0, p1, p2, p3, p4, p5 0 to p5 2 (valid with or without wait) note: the above pins are set to high-impedance regardless of the input level of the byte pin and bit (pm06) of processor mode register 0 selects the function of ports p4 0 to p4 3 . t h(bclkChold) t su(holdCbclk) (valid only with wait) t d(bclkChlda) t d(bclkChlda) hiCz rdy input tsu(rdyCbclk) th(bclkCrdy) bclk rd (multiplexed bus) (multiplexed bus) wr, wrl, wrh wr, wrl, wrh (separate bus) rd (separate bus) figure 1.23.3. v cc = 5v timing diagram (2)
timing (vcc = 5v) 158 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r bclk csi ale C4ns.min rd 25ns.max 0ns.min 4ns.min 4ns.min hiCz db 0ns.min adi bhe read timing bclk csi ale 25ns.max 0ns.min 4ns.min 4ns.min hi-z db 40ns.max 4ns.min (tcyc/2C40)ns.min adi bhe write timing t d(bclkCad) t d(bclkCale) t h(bclkCale) t su(dbCrd) t h(bclk-ad) t d(bclkCwr) t h(bclkCdb) t d(bclkCrd) t d(bclkCale) 40ns.min t ac1(rdCdb) memory expansion mode and microprocessor mode (with no wait) wr,wrl, wrh t d(bclkCcs) 25ns.max tcyc t h(bclkCcs) t h(rdCcs) 0ns.min 25ns.max t h(bclkCad) t h(rdCad) 0ns.min t h(bclkCrd) 25ns.max t h(rdCdb) t d(bclkCcs) 25ns.max t h(bclkCcs) tcyc t h(wrCcs) 0ns.min t d(bclkCad) 25ns.max 25ns.max t h(bclkCale) C4ns.min t h(wrCad) 0ns.min t h(bclkCwr) t d(bclkCdb) t d(dbCwr) t h(wrCdb) 0ns.min v cc = 5v figure 1.23.4. v cc = 5v timing diagram (3)
timing (vcc = 5v) 159 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r bclk csi ale rd 4ns.min hiCz db 40ns.min 0ns.min adi bhe read timing bclk csi ale 4ns.min t h(wrCad) adi bhe (tcycC40)ns.min 0ns.min dbi write timing t d(bclkCrd) 0ns.min 0ns.min t h(rdCad) memory expansion mode and microprocessor mode (when accessing external memory area with wait) measuring conditions : ? v cc =5v ? input timing voltage : determined with: v il =0.8v, v ih =2.5v ? output timing voltage : determined with: v ol =0.8v, v oh =2.0v wr,wrl, wrh t d(bclkCcs) 25ns.max tcyc t h(bclkCcs) 4ns.min t h(rdCcs) 0ns.min t h(bclkCad) t d(bclkCad) 25ns.max t d(bclkCale) 25ns.max t h(bclkCale) C4ns.min t h(bclkCrd) 0ns.min 25ns.max t ac2(rdCdb) t h(rdCdb) t su(dbCrd) t d(bclkCcs) 25ns.max tcyc t h(bclkCcs) 4ns.min t h(wrCcs) 0ns.min t h(bclkCad) t d(bclkCad) 25ns.max t d(bclkCale) 25ns.max t h(bclkCale) C4ns.min t h(bclkCwr) 0ns.min t d(bclkCwr) 25ns.max t h(bclkCdb) 4ns.min t d(bclkCdb) 40ns.max t d(dbCwr) t h(wrCdb) v cc = 5v figure 1.23.5. v cc = 5v timing diagram (4)
timing (vcc = 5v) 160 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r memory expansion mode and microprocessor mode (when accessing external memory area with wait, and select multiplexed bus) bclk csi ale rd 4ns.min tcyc adi bhe adi /dbi t d(adCale) read timing 0ns.min bclk csi ale C4ns.min 4ns.min 4ns.min tcyc adi bhe adi /dbi write timing address measuring conditions : ? v cc =5v ? input timing voltage : determined with v il =0.8v, v ih =2.5v ? output timing voltage : determined with v ol =0.8v, v oh =2.0v (tcyc/2)ns.min address data input (tcyc/2)ns.min t d(bclkCale) (tcyc/2)ns.min t h(wrCcs) address (tcyc x 3/2C40)ns.min t d(bclkCale) (tcyc/2)ns.min (tcyc/2-25)ns.min address 25ns.max t su(dbCrd) tac3(rdCdb) (tcyc/2)ns.min t h(aleCad) 30ns.min t d(adCrd) 0ns.min t dz(rdCad) 8ns.max t d(adCwr) 0ns.min data output wr,wrl, wrh t d(bclkCcs) 25ns.max t h(rdCcs) t h(bclkCcs) 4ns.min t h(bclkCad) t h(rdCdb) 0ns.min 40ns.min 25ns.max t d(bclkCad) C4ns.min t h(bclkCale) t d(bclkCrd) 25ns.max t h(rdCad) t h(bclkCrd) 0ns.min t d(bclkCcs) 25ns.max t h(bclkCcs) t h(bclkCdb) 4ns.min t h(wrCdb) t d(dbCwr) t h(bclkCad) t d(adCale) (tcyc/2C25)ns.min t d(bclkCad) 25ns.max 25ns.max t h(bclkCale) 25ns.max t d(bclkCwr) t h(bclkCwr) t h(wrCad) t d(bclkCdb) 40ns.max v cc = 5v figure 1.23.6. v cc = 5v timing diagram (5)
electrical characteristics (vcc = 3v) 161 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r s y m b o l v o h h i g h o u t p u t v o l t a g e v o h v o l l o w o u t p u t v o l t a g e low output voltage v ol h i g h o u t p u t v o l t a g e standard typ. u n i t measuring condition v v x o u t 2 . 5 2 . 5 v 0.5 v x o u t 0.5 0.5 m i nm a x . 2 . 5 p a r a m e t e r i o h = - 1 m a , v c c = 3 . 0 v i o h = - 0 . 1 m a , v c c = 3 . 0 v i o h = - 5 0 a , v c c = 3 . 0 v i o l = 1 m a , v c c = 3 . 0 v i ol = 0.1ma, v cc =3.0v i ol = 50 a, v cc =3.0v p 0 0 t o p 0 7 , p 1 0 t o p 1 7 , p 2 0 t o p 2 7 , p 0 0 t o p 0 7 , p 1 0 t o p 1 7 , p 2 0 t o p 2 7 , p 3 0 t o p 3 7 , p 4 0 t o p 4 7 , p 5 0 t o p 5 7 , p 3 0 t o p 3 7 , p 4 0 t o p 4 7 , p 5 0 t o p 5 7 , p 6 0 t o p 6 7 , p 7 2 t o p 7 7 , p 8 0 t o p 8 4 , h i g h p o w e r l o w p o w e r p 8 6 , p 8 7 , p 9 0 t o p 9 7 , p 1 0 0 t o p 1 0 7 highpower lowpower p 6 0 t o p 6 7 , p 7 0 t o p 7 7 , p 8 0 t o p 8 4 , p 8 6 , p 8 7 , p 9 0 t o p 9 7 , p 1 0 0 t o p 1 0 7 h i g h p o w e r l o w p o w e r h i g h o u t p u t v o l t a g ex c o u t w i t h n o l o a d a p p l i e d , v c c = 3 . 0 v w i t h n o l o a d a p p l i e d , v c c = 3 . 0 v 3.0 1 . 6 v hysteresis hysteresis high input current i ih low input current i i l v r a m ram retention voltage i c cp o w e r s u p p l y c u r r e n t v t+- v t- v t + - v t - 0 . 20 . 8 v 0.2 1.8 v p0 0 to p0 7 , p1 0 to p1 7 , p2 0 to p2 7 , p3 0 to p3 7 , p4 0 to p4 7 ,p5 0 to p5 7 , p6 0 to p6 7 , p7 0 to p7 7 , p8 0 to p8 7 , p9 0 to p9 7 , p10 0 to p10 7, 4.0 a a when clock is stopped 2.0 v reset x i n , r e s e t , c n v s s , b y t e v i = 3v, v cc =3.0v v i = 0 v , v c c = 3 . 0 v- 4 . 0 p0 0 to p0 7 , p1 0 to p1 7 , p2 0 to p2 7 , p3 0 to p3 7 , p4 0 to p4 7 , p5 0 to p5 7 , p6 0 to p6 7 , p7 0 to p7 7 , p8 0 to p8 7 , p9 0 to p9 7 , p10 0 to p10 7, x in , reset, cnvss, byte s quare wave f(x cin ) = 32khz 4 0 . 0 a r f x i n r f x c i n f e e d b a c k r e s i s t a n c ex i n f e e d b a c k r e s i s t a n c ex c i n 1 0 . 0 3 . 0 m m s quare wave, no di v i s i on f(x in ) = 10mhz ma 8.5 21.25 r pullup 120.0 k p0 0 to p0 7 , p1 0 to p1 7 , p2 0 to p2 7 , p3 0 to p3 7 , p4 0 to p4 7 , p5 0 to p5 7 , p6 0 to p6 7 , p7 2 to p7 7 , p8 0 to p8 4 , p8 6 , p8 7 , p9 0 to p9 7 ,p10 0 to p10 7 l o w o u t p u t v o l t a g e v x c o u t 0 0 with no load applied, v cc =3.0v with no load applied, v cc =3.0v highpower lowpower v i = 0 v , v c c = 3 . 0 v 66.0 500.0 i n s i n g l e - c h i p m o d e , t h e o u t p u t p i n s a r e o p e n a n d o t h e r p i n s a r e v s s p u l l - u p r e s i s t a n c e ? ? ? clk 0 to clk 4 ,ta2 out , tb1 in , tb2 in , int 0 to int 2 , nmi, a d t r g , c t s 0 t o c t s 2 , s c l , s d a h o l d , r d y , t a 0 i n t o t a 2 i n , ki 0 to ki 3 , rxd 0 to rxd 2 1 . 0 a 2 0 . 0 0 . 9 a 2 . 8 a f(x cin ) = 32khz f ( x c i n ) = 3 2 k h z topr = 85 c when clock is stopped topr = 25 c when clock is stopped wh en a waiti nstruct i on is executed. oscillation capacity high (note 2) w h e n a w a i t i n s t r u c t i o n i s e x e c u t e d . o s c i l l a t i o n c a p a c i t y l o w ( n o t e 2 ) n o t e 1 : s p e c i f y a p r o d u c t o f - 4 0 c t o 8 5 c t o u s e i t . n o t e 2 : w i t h o n e t i m e r o p e r a t e d u s i n g f c 3 2 . 10 1 0 (topr = 25 c) (topr = 25 c) v c c = 3 . 0 v v c c = 3 . 0 v v cc = 3v table 1.23.23. electrical characteristics (referenced to v cc = 2.7 to 3.3v, v ss = 0v at topr = 20 o c to 85 o c / 40 o c to 85 o c (note 1), f(x in ) = 10mh z with wait unless otherwise specified)
electrical characteristics (vcc = 3v) 162 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r 9 10 min. data input setup time ns t su(db-rd) t su(rdy-bclk ) parameter symbol unit max. standard rdy input setup time ns data input hold time ns t h(rd-db) t h(bclk -rdy) ns rdy input hold time ns hold input setup time t su(hold-bclk ) ns hold input hold time t h(bclk-hold ) data input access time (no wait) ns t ac1(rd-db) ns ns t ac2(rd-db) t ac3(rd-db) data input access time (with wait) data input access time (when accessing multiplex bus area) ns hlda output delay time t d(bclk-hlda) 80 60 0 0 80 0 (note) (note) (note) note: calculated according to the bclk frequency as follows: 100 max. min. parameter symbol unit standard ns t r external clock rise time 18 ns t f external clock fall time 18 t ac1(rd C db) = f(bclk) x 2 C 90 [ns] t ac2(rd C db) = f(bclk) x 2 C 90 3 x 10 9 [ns] t ac3(rd C db) = f(bclk) x 2 C 90 3 x 10 9 [ns] t c external clock input cycle time ns 100 t w(h ) external clock input high pulse width ns 40 t w(l) external clock input low pulse width ns 40 v cc = 3v table 1.23.25. memory expansion and microprocessor modes timing requirements (referenced to v cc = 3v, v ss = 0v at topr = 20 o c to 85 o c / 40 o c to 85 o c (*) unless otherwise specified) * : specify a product of -40 c to 85 c to use it. table 1.23.24. external clock input
electrical characteristics (vcc = 3v) 163 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r v cc = 3v timing requirements (referenced to v cc = 3v, v ss = 0v at topr = 20 o c to 85 o c / 40 o c to 85 o c (*) unless otherwise specified) * : specify a product of -40 c to 85 c to use it. standard max. min. unit parameter symbol ns t w(tal) tai in input low pulse width 60 ns t c(ta) tai in input cycle time 150 ns t w(tah) tai in input high pulse width 60 standard max. min. unit parameter symbol ns t c(ta) tai in input cycle time 600 ns t w(tah) tai in input high pulse width 300 ns t w(tal) tai in input low pulse width 300 standard max. min. unit parameter symbol ns t c(ta) tai in input cycle time 300 ns t w(tah) tai in input high pulse width 150 ns t w(tal) tai in input low pulse width 150 standard max. min. unit parameter symbol ns t w(tah) tai in input high pulse width 150 ns t w(tal) tai in input low pulse width 150 standard max. min. unit parameter symbol ns t c(up) tai out input cycle time 3000 ns t w(uph) tai out input high pulse width 1500 ns t w(upl) tai out input low pulse width 1500 ns t su(up-t in ) tai out input setup time 600 ns t h(t in- up) tai out input hold time 600 table 1.23.27. timer a input (gating input in timer mode) table 1.23.28. timer a input (external trigger input in one-shot timer mode) table 1.23.29. timer a input (external trigger input in pulse width modulation mode) table 1.23.30. timer a input (up/down input in event counter mode) table 1.23.26. timer a input (counter input in event counter mode)
electrical characteristics (vcc = 3v) 164 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r timing requirements (referenced to v cc = 3v, v ss = 0v at topr = 20 o c to 85 o c / 40 o c to 85 o c (*) unless otherwise specified) * : specify a product of -40 c to 85 c to use it. v cc = 3v standard max. min. parameter symbol unit ns t c(tb) tbi in input cycle time (counted on one edge) 150 ns t w(tbh) tbi in input high pulse width (counted on one edge) 60 ns t w(tbl) tbi in input low pulse width (counted on one edge) 60 t w(tbh) ns tbi in input high pulse width (counted on both edges) 160 t w(tbl) ns tbi in input low pulse width (counted on both edges) 160 t c(tb) ns tbi in input cycle time (counted on both edges) 300 standard max. min. parameter symbol unit ns t c(tb) tbi in input cycle time 600 ns t w(tbh) tbi in input high pulse width 300 t w(tbl) ns tbi in input low pulse width 300 standard max. min. parameter symbol unit ns t c(tb) tbi in input cycle time 600 ns t w(tbh) tbi in input high pulse width 300 t w(tbl) ns tbi in input low pulse width 300 standard max. min. parameter symbol unit ns t c(ad) ad trg input cycle time (trigger able minimum) 1500 ns t w(adl) ad trg input low pulse width 200 standard max. min. parameter symbol unit ns t w(inh) inti input high pulse width 380 ns t w(inl) inti input low pulse width 380 standard max. min. parameter symbol unit ns t c(ck) clki input cycle time 300 ns t w(ckh) clki input high pulse width 150 ns t w(ckl) clki input low pulse width 150 t h(c-q) ns txdi hold time 0 t su(d-c) ns rxdi input setup time 50 t h(c-d) ns rxdi input hold time 90 t d(c-q) ns txdi output delay time 160 table 1.23.31. timer b input (counter input in event counter mode) table 1.23.32. timer b input (pulse period measurement mode) table 1.23.33. timer b input (pulse width measurement mode) table 1.23.34. a-d trigger input table 1.23.35. serial i/o _______ table 1.23.36. external interrupt inti inputs
electrical characteristics (vcc = 3v) 165 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r t d(bclk-ad) address output delay time 60 ns t d(bclk-cs) chip select output delay time 60 ns t h(bclk-ad) address output hold time (bclk standard) 4 ns t h(bclk-cs) chip select output hold time (bclk standard) 4 ns t d(bclk-ale) ale signal output delay time 60 ns t h(bclk-ale) ale signal output hold time ? 4 ns t d(bclk-rd) rd signal output delay time 60 ns t h(bclk-rd) rd signal output hold time 0 ns t h(rd-ad) address output hold time (rd standard) 0 ns t d(bclk-wr) wr signal output delay time 60 ns t h(bclk-wr) wr signal output hold time 0 ns t h(wr-ad) address output hold time (wr standard) 0 ns t d(bclk-db) data output delay time (bclk standard) 80 ns t h(bclk-db) data output hold time (bclk standard) 4 ns t d(db-wr) data output delay time (wr standard) (note1) ns t h(wr-db) data output hold time (wr standard)(note2) 0 ns note 1: calculated according to the bclk frequency as follows: td(db C wr) = f(bclk) x 2 10 9 C 80 [ns] symbol standard measuring condition max. min. parameter unit note 2: this is standard value shows the timing when the output is off, and doesn't show hold time of data bus. hold time of data bus is different by capacitor volume and pull-up (pull-down) resistance value. hold time of data bus is expressed in t = Ccr x ln (1 C v ol / v cc ) by a circuit of the right figure. for example, when v ol = 0.2v cc , c = 30pf, r = 1k ? , hold time of output l level is t = C 30pf x 1k ? x ln (1 C 0.2v cc / v cc ) = 6.7ns. dbi r c note 3: specify a product of -40c to 85c to use it. switching characteristics (referenced to v cc = 3v, v ss = 0v at topr = 20 o c to 85 o c / 40 o c to 85 o c (note 3), cm15= 1 unless otherwise specified) v cc = 3v figure 1.23.7 table 1.23.37. memory expansion and microprocessor modes (with no wait) figure 1.23.7. port p0 to p10 measurement circuit p6 p7 p8 p10 p9 p0 p1 p2 p3 p4 p5 30pf
electrical characteristics (vcc = 3v) 166 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r switching characteristics (referenced to v cc = 3v, v ss = 0v at topr = 20 o c to 85 o c / 40 o c to 85 o c (note 3), cm15= 1 unless otherwise specified) v cc = 3v figure 1.23.7 table 1.23.38. memory expansion and microprocessor modes (when accessing external memory area with wait) t d(bclk-ad) address output delay time 60 ns t d(bclk-cs) chip select output delay time 60 ns t h(bclk-ad) address output hold time (bclk standard) 4 ns t h(bclk-cs) chip select output hold time (bclk standard) 4 ns t d(bclk-ale) ale signal output delay time 60 ns t h(bclk-ale) ale signal output hold time C 4 ns t d(bclk-rd) rd signal output delay time 60 ns t h(bclk-rd) rd signal output hold time 0 ns t h(rd-ad) address output hold time (rd standard) 0 ns t d(bclk-wr) wr signal output delay time 60 ns t h(bclk-wr) wr signal output hold time 0 ns t h(wr-ad) address output hold time (wr standard) 0 ns t d(bclk-db) data output delay time (bclk standard) 80 ns t h(bclk-db) data output hold time (bclk standard) 4 ns t d(db-wr) data output delay time (wr standard) (note1) ns t h(wr-db) data output hold time (wr standard)(note2) 0 ns note 1: calculated according to the bclk frequency as follows: td(db C wr) = f(bclk) 10 9 C 80 [ns] symbol standard measuring condition max. min. parameter unit note 2: this is standard value shows the timing when the output is off, and doesn't show hold time of data bus. hold time of data bus is different by capacitor volume and pull-up (pull-down) resistance value. hold time of data bus is expressed in t = Ccr x ln (1 C v ol / v cc ) by a circuit of the right figure. for example, when v ol = 0.2v cc , c = 30pf, r = 1k ? , hold time of output l level is t = C 30pf x 1k ? x ln (1 C 0.2v cc / v cc ) = 6.7ns. dbi r c note 3: specify a product of -40c to 85c to use it.
electrical characteristics (vcc = 3v) 167 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r v cc = 3v switching characteristics (referenced to v cc = 3v, v ss = 0v at topr = 20 o c to 85 o c / 40 o c to 85 o c (note 2), cm15= 1 unless otherwise specified) table 1.23.39. memory expansion and microprocessor modes (when accessing external memory area with wait, and select multiplexed bus) symbol standard measuring condition max. min. parameter unit t d(bclk-ad) address output delay time 60 ns t h(bclk-ad) address output hold time (bclk standard) 4 ns t d(bclk-cs) chip select output delay time 60 ns t h(bclk-cs) chip select output hold time (bclk standard) 4 ns ns t h(rd-ad) address output hold time (rd standard) (note1) t d(bclk-rd) rd signal output delay time 60 ns t h(bclk-rd) rd signal output hold time 0 ns ns t h(wr-ad) address output hold time (wr standard) (note1) t d(bclk-wr) wr signal output delay time 60 ns t d(bclk-db) data output delay time (bclk standard) 80 ns t h(bclk-db) data output hold time (bclk standard) 4 ns t d(db-wr) data output delay time (wr standard) (note1) ns t h(bclk-ale) ale signal output hold time (bclk standard) C 4 ns t d(ad-ale) ale signal output delay time (address standard) (note1) ns t h(ale-ad) ale signal output hold time(address standard) 50 ns t h(bclk-wr) wr signal output hold time 0 ns ns t h(rd-cs) chip select output hold time (rd standard) (note1) t h(wr-cs) chip select output hold time (wr standard) (note1) ns t d(ad-rd) post-address rd signal output delay time ns 0 t d(ad-wr) post-address wr signal output delay time ns 0 t dz(rd-ad) address output floating start time ns 8 t d(bclk-ale) ale signal output delay time (bclk standard) ns 60 note 1: calculated according to the bclk frequency as follows: th(rd C ad) = f(bclk) x 2 10 9 [ns] th(wr C ad) = f(bclk) x 2 10 9 [ns] th(rd C cs) = f(bclk) x 2 10 9 [ns] th(wr C cs) = f(bclk) x 2 10 9 [ns] td(db C wr) = f(bclk) x 2 10 9 C 80 [ns] x 3 td(ad C ale) = f(bclk) x 2 10 9 C 45 [ns] th(wr C db) = f(bclk) x 2 10 9 [ns] t h(wr-db) data output hold time (wr standard) ns (note1) note 2: specify a product of -40c to 85c to use it. figure 1.23.7
timing (vcc = 3v) 168 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r v cc = 3v t su(dCc) tai in input tai out input during event counter mode tbi in input clki txdi rxdi t c(ta) t w(tah) t w(tal) t c(up) t w(uph) t w(upl) t c(tb) t w(tbh) t w(tbl) t c(ad) t w(adl) t c(ck) t w(ckh) t w(ckl) t w(inl) t w(inh) t d(cCq) t h(cCd) t h(cCq) t h(t in Cup) t su(upCt in ) tai in input (when count on falling edge is selected) tai in input (when count on rising edge is selected) tai out input (up/down input) inti input ad trg input figure 1.23.8. v cc = 3v timing diagram (1)
timing (vcc = 3v) 169 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r v cc = 3v measuring conditions : ? v cc =3v ? input timing voltage : determined with v il =0.6v, v ih =2.4v ? output timing voltage : determined with v ol =1.5v, v oh =1.5v memory expansion mode and microprocessor mode bclk hold input hlda output p0, p1, p2, p3, p4, p5 0 to p5 2 (valid with or without wait) note: the above pins are set to high-impedance regardless of the input level of the byte pin and bit (pm06) of processor mode register 0 selects the function of ports p4 0 to p4 3 . t h(bclkChold) t su(holdCbclk) (valid only with wait) t d(bclkChlda) t d(bclkChlda) hiCz rdy input tsu(rdyCbclk) th(bclkCrdy) bclk rd (multiplexed bus) (multiplexed bus) wr, wrl, wrh wr, wrl, wrh (separate bus) rd (separate bus) figure 1.23.9. v cc = 3v timing diagram (2)
timing (vcc = 3v) 170 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r read timing write timing bclk csi ale rd 60ns.max 4ns.min 4ns.min hiCz db 0ns.min adi bhe tcyc 80ns.min bclk csi ale C4ns.min 60ns.max 0ns.min 4ns.min hiCz db 4ns.min adi bhe tcyc t h(bclkCale) t h(bclkCdb) t d(bclkCale) t d(bclkCwr) 0ns.min t h(wrCad) memory expansion mode and microprocessor mode (with no wait) wr,wrl, wrh t d(bclkCcs) 60ns.max t h(bclkCcs) t h(rdCcs) t d(bclkCad) 60ns.max t h(bclkCad) 60ns.max t d(bclkCale) C4ns.min t h(rdCad) 0ns.min t d(bclkCrd) t h(bclkCrd) t ac1(rdCdb) t h(rdCdb) 0ns.min t su(dbCrd) t d(bclkCcs) t h(bclkCcs) 4ns.min 60ns.max 0ns.min t h(wrCcs) t d(bclkCad) 60ns.max t h(bclkCad) 60ns.max t h(bclkCale) t h(bclkCwr) t d(bclkCdb) t h(wrCdb) t d(dbCwr) ( tc y c/2C80 ) ns.min 0ns.min 80ns.max 0ns.min v cc = 3v figure 1.23.10. v cc = 3v timing diagram (3)
timing (vcc = 3v) 171 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r read timing write timing bclk csi ale rd 4ns.min 4ns.min hiCz db 80ns.min 0ns.min adi bhe t d(bclkCwr) 60ns.max t h(bclkCwr) 0ns.min bclk csi t d(bclkCcs) 60ns.max t d(bclkCad) ale t h(bclkCale) t h(bclkCcs) 4ns.min tcyc 0ns.min t h(wrCcs) 0ns.min t h(wrCad) adi bhe t d(bclkCdb) 4ns.min t h(bclkCdb) t d(dbCwr) (tcycC80)ns.min 0ns.min t h(wrCdb) dbi t h(rdCad) 0ns.min t d(bclkCale) 60ns.max t su(dbCrd) memory expansion mode and microprocessor mode (when accessing external memory area with wait) measuring conditions : ? v cc =3v ? input timing voltage : determined with v il =0.48v, v ih =1.5v ? output timing voltage : determined with v ol =1.5v, v oh =1.5v wr,wrl, wrh t d(bclkCcs) 60ns.max t h(rdCcs) tcyc t d(bclkCad) 60ns.max t h(bclkCad) C4ns.min t h(bclkCale) 60ns.max t d(bclkCrd) t h(bclkCrd) 0ns.min t ac2(rdCdb) t h(rdCdb) 0ns.min t h(bclkCad) 60ns.max t d(bclkCale) 60ns.max C4ns.min 80ns.max t h(bclkCcs) 4ns.min v cc = 3v figure 1.23.11. v cc = 3v timing diagram (4)
timing (vcc = 3v) 172 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r memory expansion mode and microprocessor mode (when accessing external memory area with wait, and select multiplexed bus) measuring conditions : ? v cc =3v ? input timing voltage : determined with v il =0.48v,v ih =1.5v ? output timing voltage : determined with v ol =1.5v,v oh =1.5v read timing write timing 0ns.min bclk csi ale 60ns.max C4ns.min t h(bclkCcs) 4ns.min tcyc adi bhe 80ns.max t h(bclkCdb) 4ns.min t d(dbCwr) (tcyc x 3/2C80)ns.min adi /dbi address data output (tcyc/2)ns.min address (tcyc/2C60)ns.min t d(bclkCale) t d(bclkCwr) 4ns.min bclk csi t d(bclkCcs) 60ns.max ale rd 4ns.min t h(bclkCcs) 4ns.min tcyc adi bhe adi /dbi t h(rdCdb) 0ns.min address (tcyc/2)ns.min data input address tac3(rdCdb) t dz(rdCad) 8ns.max t d(adCrd) 0ns.min t d(adCwr) wr,wrl, wrh t h(rdCcs) t d(adCale) (tcyc/2C45)ns.min t su(dbCrd) 80ns.min t h(aleCad) 50ns.min t d(bclkCad) 60ns.max 60ns.max t d(bclkCale) t h(bclkCale) C4ns.min (tcyc/2)ns.min t h(rdCad) t h(bclkCad) t h(bclkCrd) 0ns.min t d(bclkCrd) 60ns.max t d(bclkCcs) 60ns.max t h(wrCcs) (tcyc/2)ns.min t d(bclkCdb) t d(adCale) t d(bclkCad) 60ns.max t h(wrCdb) (tcyc/2)ns.min t h(bclkCad) t h(wrCad) t h(bclkCwr) t h(bclkCale) 0ns.min 60ns.max v cc = 3v figure 1.23.12. v cc = 3v timing diagram (5)
173 package outline mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r lqfp100-p-1414-0.50 weight(g) 0.63 jedec code eiaj package code lead material cu alloy 100p6q-a plastic 100pin 14 ? 14mm body lqfp 0.1 0.2 symbol min nom max a a 2 b c d e h e l l 1 y b 2 dimension in millimeters h d a 1 0.225 i 2 0.9 m d 14.4 m e 14.4 10 0 0.1 1.0 0.7 0.5 0.3 16.2 16.0 15.8 16.2 16.0 15.8 0.5 14.1 14.0 13.9 14.1 14.0 13.9 0.175 0.125 0.105 0.28 0.18 0.13 1.4 0 1.7 e e e h e 1 76 75 51 50 26 25 h d d a f y 100 lp 0.45 0.6 0.25 0.75 0.08 x a3 b x m a 1 a 2 l 1 l detail f lp a3 c m d l 2 b 2 m e e recommended mount pad mmp qfp100-p-1420-0.65 1.58 weight(g) jedec code eiaj package code lead material alloy 42 100p6s-a plastic 100pin 14 ? 20mm body qfp 0.1 0.2 symbol min nom max a a 2 b c d e h e l l 1 y b 2 dimension in millimeters h d a 1 0.35 i 2 1.3 m d 14.6 m e 20.6 10 0 0.1 1.4 0.8 0.6 0.4 23.1 22.8 22.5 17.1 16.8 16.5 0.65 20.2 20.0 19.8 14.2 14.0 13.8 0.2 0.15 0.13 0.4 0.3 0.25 2.8 0 3.05 e e e e c h e 1 30 31 81 50 80 51 h d d m d m e a f a 1 a 2 l 1 l y b 2 i 2 recommended mount pad detail f 100 x 0.13 b x m mmp package outline
sfr difference between m16c/62a and m16c/30 174 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r sfr difference between m16c/62a and m16c/30 address symbol m16c/62a m16c/30 0005 pm1 processor mode register 1 bit0:reserved bit bit1:nothing is assigned bit2:nothing is assigned pm13:internal reserved area expansion bit bit4:reserved bit bit5:reserved bit bit6:reserved bit pm17:wait bit processor mode register 1 bit0:reserved bit bit1:nothing is assigned bit2:nothing is assigned bit3:reserved bit bit4:reserved bit bit5:reserved bit bit6:reserved bit pm17:wait bit 000a prcr protect register prc0:enables writing to system clock control registers 0 and 1 prc1:enables writing to processor mode registers 0 and 1 prc2:enables writing to port p9 direction register and si/o control register bit3-bit7:nothing is assigned protect register prc0:enables writing to system clock control registers 0 and 1 prc1:enables writing to processor mode registers 0 and 1 prc2:enables writing to port p9 direction register bit3-bit7:nothing is assigned 0030 sar1 dma1 source pointer reserved register 0031 sar1 dma1 source pointer reserved register 0032 sar1 dma1 source pointer reserved register 0034 dar1 dma1 destination pointer reserved register 0035 dar1 dma1 destination pointer reserved register 0036 dar1 dma1 destination pointer reserved register 0038 tcr1 dma1 transfer counter reserved register 0039 tcr1 dma1 transfer counter reserved register 003c dm1con dma1 control register reserved register 0044 int3ic int3 interrupt control register reserved register 0045 tb5ic timer b5 interrupt control register reserved register 0046 tb4ic timer b4 interrupt control register reserved register 0047 tb3ic timer b3 interrupt control register reserved register 0048 s4ic/int5ic si/o4,int5 interrupt control register reserved register 0049 s3ic/int4ic si/o3,int4 interrupt control register reserved register 004c dm1ic dma1 interrupt control register reserved register 0058 ta3ic timer a3 interrupt control register reserved register 0059 ta4ic timer a4 interrupt control register reserved register 005a tb0ic timer b0 interrupt control register reserved register 0340 tbsr timer b3, 4, 5 count start flag reserved register 0342 ta11 timer a1-1 register reserved register 0343 ta11 timer a1-1 register reserved register 0344 ta21 timer a2-1 register reserved register 0345 ta21 timer a2-1 register reserved register 0346 ta41 timer a4-1 register reserved register 0347 ta41 timer a4-1 register reserved register 0348 invc0 three-phase pwm control register 0 reserved register 0349 invc1 three-phase pwm control register 1 reserved register 034a idb0 three-phase output buffer register 0 reserved register 034b idb1 three-phase output buffer register 1 reserved register 034c dtt dead time timer reserved register 034d ictb2 timer b2 interrupt occurrence frequency set counter reserved register
mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r sfr difference between m16c/62a and m16c/30 175 sfr difference between m16c/62a and m16c/30 address symbol m16c/62a m16c/30 035f ifsr interrupt cause select register ifsr0:int0 interrupt polarity switching bit ifsr1:int1 interrupt polarity switching bit ifsr2:int2 interrupt polarity switching bit ifsr3:int3 interrupt polarity switching bit ifsr4:int4 interrupt polarity switching bit ifsr5:int5 interrupt polarity switching bit ifsr6:interrupt request cause select bit ifsr7:interrupt request cause select bit interrupt cause select register ifsr0:int0 interrupt polarity switching bit ifsr1:int1 interrupt polarity switching bit ifsr2:int2 interrupt polarity switching bit bit3:reserved bit bit4:reserved bit bit5:reserved bit bit6:reserved bit bit7:reserved bit 0360 s3trr si/o3 transmit/receive register reserved register 0362 s3c si/o3 control register reserved register 0363 s3brg si/o3 bit rate generator reserved register 0364 s4trr si/o4 transmit/receive register reserved register 0366 s4c si/o4 control register reserved register 0367 s4brg si/o4 bit rate generator reserved register 0380 tabsr count start flag ta0s:timer a0 count start flag ta1s:timer a1 count start flag ta2s:timer a2 count start flag ta3s:timer a3 count start flag ta4s:timer a4 count start flag tb0s:timer b0 count start flag tb1s:timer b1 count start flag tb2s:timer b2 count start flag count start flag ta0s:timer a0 count start flag ta1s:timer a1 count start flag ta2s:timer a2 count start flag bit3:reserved bit bit4:reserved bit bit5:reserved bit tb1s:timer b1 count start flag tb2s:timer b2 count start flag 0382 onsf one-shot start flag ta0os:timer a0 one-shot start flag ta1os:timer a1 one-shot start flag ta2os:timer a2 one-shot start flag ta3os:timer a3 one-shot start flag ta4os:timer a4 one-shot start flag bit5:nothing is assigned ta0tgl:timer a0 event/trigger select bit ta0tgh: "00","01","10"and"11" can be chosen. one-shot start flag ta0os:timer a0 one-shot start flag ta1os:timer a1 one-shot start flag ta2os:timer a2 one-shot start flag bit3:reserved bit bit4:reserved bit bit5:nothing is assigned ta0tgl:timer a0 event/trigger select bit ta0tgh: "00","01"and"11" can be chosen. "10" can't be chosen. 0383 trgsr trigger select register ta1tgl:timer a1 event/trigger select bit ta1tgh: "00","01","10"and"11" can be chosen. ta2tgl:timer a2 event/trigger select bit ta2tgh: "00","01","10"and"11" can be chosen. ta3tgl:timer a3 event/trigger select bit ta3tgh: "00","01","10"and"11" can be chosen. ta4tgl:timer a4 event/trigger select bit ta4tgh: "00","01","10"and"11" can be chosen. trigger select register ta1tgl:timer a1 event/trigger select bit ta1tgh: "00","01","10"and"11" can be chosen. ta2tgl:timer a2 event/trigger select bit ta2tgh: "00","01"and"10" can be chosen. "11" can't be chosen. bit4:reserved bit bit5:reserved bit bit6:reserved bit bit7:reserved bit 0384 udf up-down flag ta0ud:timer a0 up/down flag ta1ud:timer a1 up/down flag ta2ud:timer a2 up/down flag ta3ud:timer a3 up/down flag ta4ud:timer a4 up/down flag ta2p:timer a2 two-phase pulse signal processing select bit ta3p:timer a3 two-phase pulse signal processing select bit ta4p:timer a4 two-phase pulse signal processing select bit up-down flag ta0ud:timer a0 up/down flag ta1ud:timer a1 up/down flag ta2ud:timer a2 up/down flag bit3:reserved bit bit4:reserved bit ta2p:timer a2 two-phase pulse signal processing select bit bit6:reserved bit bit7:reserved bit
sfr difference between m16c/62a and m16c/30 176 mitsubishi microcomputer s m16c / 30 grou p single-chip 16-bit cmos microcompute r sfr difference between m16c/62a and m16c/30 address symbol m16c/62a m16c/30 039c tb1mr timer b1 mode register event counter mode tmod0:operation mode select bit tmod1: mr0:count polarity select bit mr1: mr2:nothing is assigned mr3:invalid tck1:event clock select "0" and "1" can be chosen. timer b1 mode register event counter mode tmod0:operation mode select bit tmod1: mr0:count polarity select bit mr1: mr2:nothing is assigned mr3:invalid tck1:event clock select "0 " can be chosen. "1" can't be chosen. 03b6 fmr1 flash memory control register 1 reserved register 03b7 fmr0 flash memory control register 0 reserved register 03b8 dm0sl dma0 request cause select register dma0 request factors falling edge of int0 pin software trigger timer a0 timer a1 timer a2 timer a3 timer a4 two edges of int0 pin timer b0 timer b1 timer b2 timer b3 timer b4 timer b5 uart0 transmit uart0 receive uart2 transmit uart2 receive uart1 transmit a-d conversion dma0 request cause select register dma0 request factors falling edge of int0 pin software trigger timer a0 timer a1 timer a2 two edges of int0 pin timer b1 timer b2 uart0 transmit uart0 receive uart2 transmit uart2 receive uart1 transmit a-d conversion 03ba dm1sl dma1 request cause select register reserved register 03bc crcd crc data register reserved register 03bd crcin crc data register reserved register 03be crcin crc input register reserved register 03d6 adcon0 a-d control register 0 ch0:analog input pin select bit ch1: ch2: md0:a-d operation mode select bit 0 md1: "00","01","10"and"11" can be chosen trg:trigger select bit adst:a-d conversion start flag cks0:frequency select bit 0 a-d control register 0 ch0:analog input pin select bit ch1: ch2: md0:a-d operation mode select bit 0 md1: "00 " can be chosen. "01","10"and"11" can't be chosen. trg:trigger select bit adst:a-d conversion start flag cks0:frequency select bit 0 03d7 adcon1 a-d control register 1 scan0:a-d sweep pin select bit scan1: md2:a-d operation mode select bit 1 bits:8/10-bit mode select bit cks1:frequency select bit 1 vcut:vref connect bit opa0:external op-amp connection mode bit opa1: a-d control register 1 bit0:reserved bit bit1:reserved bit bit2:reserved bit bits:8/10-bit mode select bit cks1:frequency select bit 1 vcut:vref connect bit opa0:external op-amp connection mode bit opa1:
? 2002 mitsubishi electric corp. printed in japan (rod) ii new publication, effective june. 2002. specifications subject to change without notice. notes regarding these materials ? these materials are intended as a reference to assist our customers in the selection of the mitsubishi semiconductor product b est suited to the customers application; they do not convey any license under any intellectual property rights, or any other rights, belonging to mitsubishi electric corporation or a third party. ? mitsubishi electric corporation assumes no responsibility for any damage, or infringement of any third-partys rights, origina ting in the use of any product data, diagrams, charts, programs, algorithms, or circuit application examples contained in these materials. ? all information contained in these materials, including product data, diagrams, charts, programs and algorithms represents inf ormation on products at the time of publication of these materials, and are subject to change by mitsubishi electric corporation without notice due to product improvements or other reasons. it is therefore recommended that c ustomers contact mitsubishi electric corporation or an authorized mitsubishi semiconductor product distributor for the latest product information before purchasing a product listed herein. the information described here may contain technical inaccuracies or typographical errors. mitsubishi electric corporation assu mes no responsibility for any damage, liability, or other loss rising from these inaccuracies or errors. please also pay attention to information published by mitsubishi electric corporation by various means, including the mitsubish i semiconductor home page (http://www.mitsubishichips.com). ? when using any or all of the information contained in these materials, including product data, diagrams, charts, programs, and algorithms, please be sure to evaluate all information as a total system before making a final decision on the applicability of the information and products. mitsubishi electric corporation assumes no responsibility for any damage, liability or other loss resulting from the information contained herein. ? mitsubishi electric corporation semiconductors are not designed or manufactured for use in a device or system that is used und er circumstances in which human life is potentially at stake. please contact mitsubishi electric corporation or an authorized mitsubishi semiconductor product distributor when considering the use of a product contained herei n for any specific purposes, such as apparatus or systems for transportation, vehicular, medical, aerospace, nuclear, or undersea repeater use. ? the prior written approval of mitsubishi electric corporation is necessary to reprint or reproduce in whole or in part these m aterials. ? if these products or technologies are subject to the japanese export control restrictions, they must be exported under a licen se from the japanese government and cannot be imported into a country other than the approved destination. any diversion or reexport contrary to the export control laws and regulations of japan and/or the country of destination is pro hibited. ? please contact mitsubishi electric corporation or an authorized mitsubishi semiconductor product distributor for further detai ls on these materials or the products contained therein. keep safety first in your circuit designs! ? mitsubishi electric corporation puts the maximum effort into making semiconductor products better and more reliable, but there is always the possibility that trouble may occur with them. trouble with semiconductors may lead to personal injury, fire or property damage. remember to give due consideration to safety when making your circuit designs, with a ppropriate measures such as (i) placement of substitutive, auxiliary circuits, (ii) use of non-flammable material or (iii) prevention against any malfunction or mishap. head office: 2-2-3, marunouchi, chiyoda-ku, tokyo 100-8310, japan


▲Up To Search▲   

 
Price & Availability of M30302M4-XXXFP

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X